Skip to content

Commit ef739b2

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Reset credit grant properly after a disconnect
On a fresh connection, an RPC/RDMA client is supposed to send only one RPC Call until it gets a credit grant in the first RPC Reply from the server [RFC 8166, Section 3.3.3]. There is a bug in the Linux client's credit accounting mechanism introduced by commit e7ce710 ("xprtrdma: Avoid deadlock when credit window is reset"). On connect, it simply dumps all pending RPC Calls onto the new connection. Servers have been tolerant of this bad behavior. Currently no server implementation ever changes its credit grant over reconnects, and servers always repost enough Receives before connections are fully established. To correct this issue, ensure that the client resets both the credit grant _and_ the congestion window when handling a reconnect. Fixes: e7ce710 ("xprtrdma: Avoid deadlock when credit ... ") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: stable@kernel.org Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 91ca186 commit ef739b2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

net/sunrpc/xprtrdma/svc_rdma_backchannel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ static void
248248
xprt_rdma_bc_close(struct rpc_xprt *xprt)
249249
{
250250
dprintk("svcrdma: %s: xprt %p\n", __func__, xprt);
251+
xprt->cwnd = RPC_CWNDSHIFT;
251252
}
252253

253254
static void

net/sunrpc/xprtrdma/transport.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,12 @@ xprt_rdma_close(struct rpc_xprt *xprt)
468468
xprt->reestablish_timeout = 0;
469469
xprt_disconnect_done(xprt);
470470
rpcrdma_ep_disconnect(ep, ia);
471+
472+
/* Prepare @xprt for the next connection by reinitializing
473+
* its credit grant to one (see RFC 8166, Section 3.3.3).
474+
*/
475+
r_xprt->rx_buf.rb_credits = 1;
476+
xprt->cwnd = RPC_CWNDSHIFT;
471477
}
472478

473479
/**

0 commit comments

Comments
 (0)