linux-stable/net/sunrpc/xprtrdma
Chuck Lever 342d9092a5 xprtrdma: Fix backchannel allocation of extra rpcrdma_reps
[ Upstream commit d698c4a02e ]

The backchannel code uses rpcrdma_recv_buffer_put to add new reps
to the free rep list. This also decrements rb_recv_count, which
spoofs the receive overrun logic in rpcrdma_buffer_get_rep.

Commit 9b06688bc3 ("xprtrdma: Fix additional uses of
spin_lock_irqsave(rb_lock)") replaced the original open-coded
list_add with a call to rpcrdma_recv_buffer_put(), but then a year
later, commit 05c974669e ("xprtrdma: Fix receive buffer
accounting") added rep accounting to rpcrdma_recv_buffer_put.
It was an oversight to let the backchannel continue to use this
function.

The fix this, let's combine the "add to free list" logic with
rpcrdma_create_rep.

Also, do not allocate RPCRDMA_MAX_BC_REQUESTS rpcrdma_reps in
rpcrdma_buffer_create and then allocate additional rpcrdma_reps in
rpcrdma_bc_setup_reps. Allocating the extra reps during backchannel
set-up is sufficient.

Fixes: 05c974669e ("xprtrdma: Fix receive buffer accounting")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-26 11:02:04 +02:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
backchannel.c xprtrdma: Fix backchannel allocation of extra rpcrdma_reps 2018-04-26 11:02:04 +02:00
fmr_ops.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
frwr_ops.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
module.c rpcrdma: Merge svcrdma and xprtrdma modules into one 2015-06-04 16:56:02 -04:00
rpc_rdma.c xprtrdma: Fix calculation of ri_max_send_sges 2018-02-22 15:42:29 +01:00
svc_rdma.c svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt 2017-04-25 17:25:55 -04:00
svc_rdma_backchannel.c svcrdma: Preserve CB send buffer across retransmits 2017-11-30 08:40:54 +00:00
svc_rdma_recvfrom.c svcrdma: Properly compute .len and .buflen for received RPC Calls 2017-07-12 15:54:57 -04:00
svc_rdma_rw.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
svc_rdma_sendto.c svcrdma: fix an incorrect check on -E2BIG and -EINVAL 2017-07-13 14:18:47 -04:00
svc_rdma_transport.c svcrdma: Estimate Send Queue depth properly 2017-09-05 15:15:31 -04:00
transport.c xprtrdma: Don't defer fencing an async RPC's chunks 2017-12-20 10:10:36 +01:00
verbs.c xprtrdma: Fix backchannel allocation of extra rpcrdma_reps 2018-04-26 11:02:04 +02:00
xprt_rdma.h xprtrdma: Fix backchannel allocation of extra rpcrdma_reps 2018-04-26 11:02:04 +02:00