nfsd: only check RPC_SIGNALLED() when restarting rpc_task
authorJeff Layton <jlayton@kernel.org>
Sun, 9 Feb 2025 12:31:25 +0000 (07:31 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 10 Mar 2025 13:11:02 +0000 (09:11 -0400)
nfsd4_cb_sequence_done() currently checks RPC_SIGNALLED() when
processing the compound and releasing the slot. If RPC_SIGNALLED()
returns true, then that means that the client is going to be torn down.

Don't check RPC_SIGNALLED() after processing a successful reply. Check
it only before restarting the rpc_task. If it returns true, then requeue
the callback instead of restarting the task.

Also, handle rpc_restart_call() and rpc_restart_call_prepare() failures
correctly, by requeueing the callback.

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

index 640d788052fd08db88fcce740b89b1d0710c6786..54f33b81d20f26189ffba70440b83c9351b4ab2a 100644 (file)
@@ -1379,8 +1379,8 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
                goto requeue;
        case -NFS4ERR_DELAY:
                cb->cb_seq_status = 1;
-               if (!rpc_restart_call(task))
-                       goto out;
+               if (RPC_SIGNALLED(task) || !rpc_restart_call(task))
+                       goto requeue;
                rpc_delay(task, 2 * HZ);
                return false;
        case -NFS4ERR_BADSLOT:
@@ -1396,14 +1396,16 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
        }
        trace_nfsd_cb_free_slot(task, cb);
        nfsd41_cb_release_slot(cb);
-
-       if (RPC_SIGNALLED(task))
-               goto requeue;
-out:
        return ret;
 retry_nowait:
-       rpc_restart_call_prepare(task);
-       goto out;
+       /*
+        * RPC_SIGNALLED() means that the rpc_client is being torn down and
+        * (possibly) recreated. Requeue the call in that case.
+        */
+       if (!RPC_SIGNALLED(task)) {
+               if (rpc_restart_call_prepare(task))
+                       return false;
+       }
 requeue:
        nfsd41_cb_release_slot(cb);
        nfsd4_requeue_cb(task, cb);