Skip to content

Commit 64d2642

Browse files
committed
svcrdma: Fix another Receive buffer leak
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 <[email protected]>
1 parent a68d5a5 commit 64d2642

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/sunrpc/xprtrdma/svc_rdma_recvfrom.c

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

278+
if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags))
279+
return 0;
278280
ctxt = svc_rdma_recv_ctxt_get(rdma);
279281
if (!ctxt)
280282
return -ENOMEM;

0 commit comments

Comments
 (0)