Skip to content

Commit 3d4cf35

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Reply buffer exhaustion can be catastrophic
Not having an rpcrdma_rep at call_allocate time can be a problem. It means that send_request can't post a receive buffer to catch the RPC's reply. Possible consequences are RPC timeouts or even transport deadlock. Instead of allowing an RPC to proceed if an rpcrdma_rep is not available, return NULL to force call_allocate to wait and try again. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent b54054c commit 3d4cf35

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

net/sunrpc/xprtrdma/verbs.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)
871871
}
872872

873873
INIT_LIST_HEAD(&buf->rb_recv_bufs);
874-
for (i = 0; i < buf->rb_max_requests + 2; i++) {
874+
for (i = 0; i < buf->rb_max_requests; i++) {
875875
struct rpcrdma_rep *rep;
876876

877877
rep = rpcrdma_create_rep(r_xprt);
@@ -989,8 +989,6 @@ rpcrdma_put_mw(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mw *mw)
989989

990990
/*
991991
* Get a set of request/reply buffers.
992-
*
993-
* Reply buffer (if available) is attached to send buffer upon return.
994992
*/
995993
struct rpcrdma_req *
996994
rpcrdma_buffer_get(struct rpcrdma_buffer *buffers)
@@ -1009,13 +1007,13 @@ rpcrdma_buffer_get(struct rpcrdma_buffer *buffers)
10091007

10101008
out_reqbuf:
10111009
spin_unlock(&buffers->rb_lock);
1012-
pr_warn("RPC: %s: out of request buffers\n", __func__);
1010+
pr_warn("rpcrdma: out of request buffers (%p)\n", buffers);
10131011
return NULL;
10141012
out_repbuf:
1013+
list_add(&req->rl_free, &buffers->rb_send_bufs);
10151014
spin_unlock(&buffers->rb_lock);
1016-
pr_warn("RPC: %s: out of reply buffers\n", __func__);
1017-
req->rl_reply = NULL;
1018-
return req;
1015+
pr_warn("rpcrdma: out of reply buffers (%p)\n", buffers);
1016+
return NULL;
10191017
}
10201018

10211019
/*

0 commit comments

Comments
 (0)