Skip to content

Commit a31b2f9

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Connection becomes unstable after a reconnect
This is because xprt_request_get_cong() is allowing more than one RPC Call to be transmitted before the first Receive on the new connection. The first Receive fills the Receive Queue based on the server's credit grant. Before that Receive, there is only a single Receive WR posted because the client doesn't know the server's credit grant. Solution is to clear rq_cong on all outstanding rpc_rqsts when the the cwnd is reset. This is because an RPC/RDMA credit is good for one connection instance only. Fixes: 75891f5 ("SUNRPC: Support for congestion control ... ") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 4b93dab commit a31b2f9

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎net/sunrpc/xprtrdma/transport.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,11 @@ void xprt_rdma_close(struct rpc_xprt *xprt)
428428
/* Prepare @xprt for the next connection by reinitializing
429429
* its credit grant to one (see RFC 8166, Section 3.3.3).
430430
*/
431+
spin_lock(&xprt->transport_lock);
431432
r_xprt->rx_buf.rb_credits = 1;
433+
xprt->cong = 0;
432434
xprt->cwnd = RPC_CWNDSHIFT;
435+
spin_unlock(&xprt->transport_lock);
433436

434437
out:
435438
xprt->reestablish_timeout = 0;

‎net/sunrpc/xprtrdma/verbs.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
* internal functions
7676
*/
7777
static void rpcrdma_sendctx_put_locked(struct rpcrdma_sendctx *sc);
78+
static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt);
7879
static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf);
7980
static void rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt);
8081
static void rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf);
@@ -780,6 +781,7 @@ rpcrdma_ep_disconnect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
780781
trace_xprtrdma_disconnect(r_xprt, rc);
781782

782783
rpcrdma_xprt_drain(r_xprt);
784+
rpcrdma_reqs_reset(r_xprt);
783785
}
784786

785787
/* Fixed-size circular FIFO queue. This implementation is wait-free and
@@ -1042,6 +1044,26 @@ struct rpcrdma_req *rpcrdma_req_create(struct rpcrdma_xprt *r_xprt, size_t size,
10421044
return NULL;
10431045
}
10441046

1047+
/**
1048+
* rpcrdma_reqs_reset - Reset all reqs owned by a transport
1049+
* @r_xprt: controlling transport instance
1050+
*
1051+
* ASSUMPTION: the rb_allreqs list is stable for the duration,
1052+
* and thus can be walked without holding rb_lock. Eg. the
1053+
* caller is holding the transport send lock to exclude
1054+
* device removal or disconnection.
1055+
*/
1056+
static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt)
1057+
{
1058+
struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
1059+
struct rpcrdma_req *req;
1060+
1061+
list_for_each_entry(req, &buf->rb_allreqs, rl_all) {
1062+
/* Credits are valid only for one connection */
1063+
req->rl_slot.rq_cong = 0;
1064+
}
1065+
}
1066+
10451067
static struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt,
10461068
bool temp)
10471069
{

0 commit comments

Comments
 (0)