Skip to content

Commit

Permalink
NFSv4.1: fix handling NFS4ERR_DELAY when testing for session trunking
Browse files Browse the repository at this point in the history
[ Upstream commit 6bd1a77 ]

Currently when client sends an EXCHANGE_ID for a possible trunked
connection, for any error that happened, the trunk will be thrown
out. However, an NFS4ERR_DELAY is a transient error that should be
retried instead.

Fixes: e818bd0 ("NFSv4.1 remove xprt from xprt_switch if session trunking test fails")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
olgakorn1 authored and gregkh committed Nov 28, 2023
1 parent 37c6ca6 commit 3c51fac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -8934,6 +8934,7 @@ void nfs4_test_session_trunk(struct rpc_clnt *clnt, struct rpc_xprt *xprt,

sp4_how = (adata->clp->cl_sp4_flags == 0 ? SP4_NONE : SP4_MACH_CRED);

try_again:
/* Test connection for session trunking. Async exchange_id call */
task = nfs4_run_exchange_id(adata->clp, adata->cred, sp4_how, xprt);
if (IS_ERR(task))
Expand All @@ -8946,11 +8947,15 @@ void nfs4_test_session_trunk(struct rpc_clnt *clnt, struct rpc_xprt *xprt,

if (status == 0)
rpc_clnt_xprt_switch_add_xprt(clnt, xprt);
else if (rpc_clnt_xprt_switch_has_addr(clnt,
else if (status != -NFS4ERR_DELAY && rpc_clnt_xprt_switch_has_addr(clnt,
(struct sockaddr *)&xprt->addr))
rpc_clnt_xprt_switch_remove_xprt(clnt, xprt);

rpc_put_task(task);
if (status == -NFS4ERR_DELAY) {
ssleep(1);
goto try_again;
}
}
EXPORT_SYMBOL_GPL(nfs4_test_session_trunk);

Expand Down

0 comments on commit 3c51fac

Please sign in to comment.