Skip to content

Commit 6221f1d

Browse files
committed
SUNRPC: Fix backchannel RPC soft lockups
Currently, after the forward channel connection goes away, backchannel operations are causing soft lockups on the server because call_transmit_status's SOFTCONN logic ignores ENOTCONN. Such backchannel Calls are aggressively retried until the client reconnects. Backchannel Calls should use RPC_TASK_NOCONNECT rather than RPC_TASK_SOFTCONN. If there is no forward connection, the server is not capable of establishing a connection back to the client, thus that backchannel request should fail before the server attempts to send it. Commit 58255a4 ("NFSD: NFSv4 callback client should use RPC_TASK_SOFTCONN") was merged several years before RPC_TASK_NOCONNECT was available. Because setup_callback_client() explicitly sets NOPING, the NFSv4.0 callback connection depends on the first callback RPC to initiate a connection to the client. Thus NFSv4.0 needs to continue to use RPC_TASK_SOFTCONN. Suggested-by: Trond Myklebust <[email protected]> Signed-off-by: Chuck Lever <[email protected]> Cc: <[email protected]> # v4.20+
1 parent 43e3392 commit 6221f1d

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

fs/nfsd/nfs4callback.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,7 @@ nfsd4_run_cb_work(struct work_struct *work)
13121312
container_of(work, struct nfsd4_callback, cb_work);
13131313
struct nfs4_client *clp = cb->cb_clp;
13141314
struct rpc_clnt *clnt;
1315+
int flags;
13151316

13161317
if (cb->cb_need_restart) {
13171318
cb->cb_need_restart = false;
@@ -1340,7 +1341,8 @@ nfsd4_run_cb_work(struct work_struct *work)
13401341
}
13411342

13421343
cb->cb_msg.rpc_cred = clp->cl_cb_cred;
1343-
rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
1344+
flags = clp->cl_minorversion ? RPC_TASK_NOCONNECT : RPC_TASK_SOFTCONN;
1345+
rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | flags,
13441346
cb->cb_ops ? &nfsd4_cb_ops : &nfsd4_cb_probe_ops, cb);
13451347
}
13461348

net/sunrpc/svc_xprt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,8 @@ static void svc_delete_xprt(struct svc_xprt *xprt)
10401040

10411041
dprintk("svc: svc_delete_xprt(%p)\n", xprt);
10421042
xprt->xpt_ops->xpo_detach(xprt);
1043+
if (xprt->xpt_bc_xprt)
1044+
xprt->xpt_bc_xprt->ops->close(xprt->xpt_bc_xprt);
10431045

10441046
spin_lock_bh(&serv->sv_lock);
10451047
list_del_init(&xprt->xpt_list);

net/sunrpc/xprtrdma/svc_rdma_backchannel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ static void
244244
xprt_rdma_bc_close(struct rpc_xprt *xprt)
245245
{
246246
dprintk("svcrdma: %s: xprt %p\n", __func__, xprt);
247+
248+
xprt_disconnect_done(xprt);
247249
xprt->cwnd = RPC_CWNDSHIFT;
248250
}
249251

net/sunrpc/xprtsock.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,6 +2584,7 @@ static int bc_send_request(struct rpc_rqst *req)
25842584

25852585
static void bc_close(struct rpc_xprt *xprt)
25862586
{
2587+
xprt_disconnect_done(xprt);
25872588
}
25882589

25892590
/*

0 commit comments

Comments
 (0)