Skip to content

Commit 88f7857

Browse files
chucklevergregkh
authored andcommitted
svcrdma: Fix another Receive buffer leak
[ Upstream commit 64d2642 ] 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>
1 parent 465bc91 commit 88f7857

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/sunrpc/xprtrdma/svc_rdma_recvfrom.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ static int svc_rdma_post_recv(struct svcxprt_rdma *rdma)
268268
{
269269
struct svc_rdma_recv_ctxt *ctxt;
270270

271+
if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags))
272+
return 0;
271273
ctxt = svc_rdma_recv_ctxt_get(rdma);
272274
if (!ctxt)
273275
return -ENOMEM;

0 commit comments

Comments
 (0)