]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nfsd: prepare nfsd4_cb_sequence_done() for error handling rework
authorJeff Layton <jlayton@kernel.org>
Sun, 9 Feb 2025 12:31:22 +0000 (07:31 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 10 Mar 2025 13:11:01 +0000 (09:11 -0400)
There is only one case where we want to proceed with processing the rest
of the CB_COMPOUND, and that's when the cb_seq_status is 0. Make the
default return value be false, and only set it to true in that case.

Rename the "need_restart" label to "requeue", to better indicate that
it's being requeued to the workqueue.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4callback.c

index 484077200c5d7e74225b7b59b9547f186e5ee8b4..041c5e7432f0b39c03f91f76f019f4885323ac05 100644 (file)
@@ -1328,11 +1328,12 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
        rpc_call_start(task);
 }
 
+/* Returns true if CB_COMPOUND processing should continue */
 static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback *cb)
 {
        struct nfs4_client *clp = cb->cb_clp;
        struct nfsd4_session *session = clp->cl_cb_session;
-       bool ret = true;
+       bool ret = false;
 
        if (!clp->cl_minorversion) {
                /*
@@ -1345,13 +1346,13 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
                 * handle that case here.
                 */
                if (RPC_SIGNALLED(task))
-                       goto need_restart;
+                       goto requeue;
 
                return true;
        }
 
        if (cb->cb_held_slot < 0)
-               goto need_restart;
+               goto requeue;
 
        /* This is the operation status code for CB_SEQUENCE */
        trace_nfsd_cb_seq_status(task, cb);
@@ -1365,11 +1366,11 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
                 * (sequence ID, cached reply) MUST NOT change.
                 */
                ++session->se_cb_seq_nr[cb->cb_held_slot];
+               ret = true;
                break;
        case -ESERVERFAULT:
                ++session->se_cb_seq_nr[cb->cb_held_slot];
                nfsd4_mark_cb_fault(cb->cb_clp);
-               ret = false;
                break;
        case 1:
                /*
@@ -1381,13 +1382,11 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
                fallthrough;
        case -NFS4ERR_BADSESSION:
                nfsd4_mark_cb_fault(cb->cb_clp);
-               ret = false;
-               goto need_restart;
+               goto requeue;
        case -NFS4ERR_DELAY:
                cb->cb_seq_status = 1;
                if (!rpc_restart_call(task))
                        goto out;
-
                rpc_delay(task, 2 * HZ);
                return false;
        case -NFS4ERR_BADSLOT:
@@ -1405,14 +1404,13 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
        nfsd41_cb_release_slot(cb);
 
        if (RPC_SIGNALLED(task))
-               goto need_restart;
+               goto requeue;
 out:
        return ret;
 retry_nowait:
-       if (rpc_restart_call_prepare(task))
-               ret = false;
+       rpc_restart_call_prepare(task);
        goto out;
-need_restart:
+requeue:
        if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
                trace_nfsd_cb_restart(clp, cb);
                task->tk_status = 0;