[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250129-nfsd-6-14-v3-6-506e71e39e6b@kernel.org>
Date: Wed, 29 Jan 2025 18:20:46 -0500
From: Jeff Layton <jlayton@...nel.org>
To: Chuck Lever <chuck.lever@...cle.com>, Neil Brown <neilb@...e.de>,
Olga Kornievskaia <okorniev@...hat.com>, Dai Ngo <Dai.Ngo@...cle.com>,
Tom Talpey <tom@...pey.com>, "J. Bruce Fields" <bfields@...ldses.org>
Cc: linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
Jeff Layton <jlayton@...nel.org>
Subject: [PATCH v3 6/6] nfsd: lift NFSv4.0 handling out of
nfsd4_cb_sequence_done()
It's a bit strange to call nfsd4_cb_sequence_done() on a callback with no
CB_SEQUENCE. Lift the handling of restarting a call into a new helper,
and move the handling of NFSv4.0 into nfsd4_cb_done().
Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
fs/nfsd/nfs4callback.c | 53 ++++++++++++++++++++++++++------------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index c8834454bcc7b5044de42ec8622653a44dbb0812..bf7248f84913ebd9e8942195b24191e494027dbf 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -1383,27 +1383,22 @@ static bool nfsd4_cb_session_changed(struct nfsd4_callback *cb)
return cb->cb_ses != rcu_access_pointer(cb->cb_clp->cl_cb_session);
}
-static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback *cb)
+static void requeue_callback(struct rpc_task *task, struct nfsd4_callback *cb)
{
struct nfs4_client *clp = cb->cb_clp;
- struct nfsd4_session *session = cb->cb_ses;
- bool ret = false;
- if (!clp->cl_minorversion) {
- /*
- * If the backchannel connection was shut down while this
- * task was queued, we need to resubmit it after setting up
- * a new backchannel connection.
- *
- * Note that if we lost our callback connection permanently
- * the submission code will error out, so we don't need to
- * handle that case here.
- */
- if (RPC_SIGNALLED(task))
- goto requeue;
-
- return true;
+ nfsd41_cb_release_slot(cb);
+ if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
+ trace_nfsd_cb_restart(clp, cb);
+ task->tk_status = 0;
+ cb->cb_need_restart = true;
}
+}
+
+static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback *cb)
+{
+ struct nfsd4_session *session = cb->cb_ses;
+ bool ret = false;
if (cb->cb_held_slot < 0)
goto requeue;
@@ -1492,19 +1487,14 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
retry_nowait:
/*
* RPC_SIGNALLED() means that the rpc_client is being torn down and
- * (possibly) recreated. Restart the call completely in that case.
+ * (possibly) recreated. Restart the whole callback in that case.
*/
if (!RPC_SIGNALLED(task)) {
rpc_restart_call_prepare(task);
return false;
}
requeue:
- nfsd41_cb_release_slot(cb);
- if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
- trace_nfsd_cb_restart(clp, cb);
- task->tk_status = 0;
- cb->cb_need_restart = true;
- }
+ requeue_callback(task, cb);
return false;
}
@@ -1515,8 +1505,21 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
trace_nfsd_cb_rpc_done(clp);
- if (!nfsd4_cb_sequence_done(task, cb))
+ if (!clp->cl_minorversion) {
+ /*
+ * If the backchannel connection was shut down while this
+ * task was queued, we need to resubmit it after setting up
+ * a new backchannel connection.
+ *
+ * Note that if we lost our callback connection permanently
+ * the submission code will error out, so we don't need to
+ * handle that case here.
+ */
+ if (RPC_SIGNALLED(task))
+ requeue_callback(task, cb);
+ } else if (!nfsd4_cb_sequence_done(task, cb)) {
return;
+ }
if (cb->cb_status) {
WARN_ONCE(task->tk_status,
--
2.48.1
Powered by blists - more mailing lists