svcrdma: Fix another Receive buffer leak
authorChuck Lever <chuck.lever@oracle.com>
Tue, 30 Jun 2020 19:55:45 +0000 (15:55 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 09:49:05 +0000 (11:49 +0200)
commita8c8ad128e19ce31b3b4ff26642f8ba4fb3674e9
tree128dd25be65c2877536e3270f65f0e9650166fdb
parent2a9eccbe614edbb6960040d3940e1ece16a2679a
svcrdma: Fix another Receive buffer leak

[ Upstream commit 64d26422516b2e347b32e6d9b1d40b3c19a62aae ]

During a connection tear down, the Receive queue is flushed before
the device resources are freed. Typically, all the Receives flush
with IB_WR_FLUSH_ERR.

However, any pending successful Receives flush with IB_WR_SUCCESS,
and the server automatically posts a fresh Receive to replace the
completing one. This happens even after the connection has closed
and the RQ is drained. Receives that are posted after the RQ is
drained appear never to complete, causing a Receive resource leak.
The leaked Receive buffer is left DMA-mapped.

To prevent these late-posted recv_ctxt's from leaking, block new
Receive posting after XPT_CLOSE is set.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c