Skip to content

Commit 1c2d095

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: prepare nfsd4_cb_sequence_done() for error handling rework
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>
1 parent 230ca75 commit 1c2d095

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

fs/nfsd/nfs4callback.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,11 +1328,12 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
13281328
rpc_call_start(task);
13291329
}
13301330

1331+
/* Returns true if CB_COMPOUND processing should continue */
13311332
static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback *cb)
13321333
{
13331334
struct nfs4_client *clp = cb->cb_clp;
13341335
struct nfsd4_session *session = clp->cl_cb_session;
1335-
bool ret = true;
1336+
bool ret = false;
13361337

13371338
if (!clp->cl_minorversion) {
13381339
/*
@@ -1345,13 +1346,13 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
13451346
* handle that case here.
13461347
*/
13471348
if (RPC_SIGNALLED(task))
1348-
goto need_restart;
1349+
goto requeue;
13491350

13501351
return true;
13511352
}
13521353

13531354
if (cb->cb_held_slot < 0)
1354-
goto need_restart;
1355+
goto requeue;
13551356

13561357
/* This is the operation status code for CB_SEQUENCE */
13571358
trace_nfsd_cb_seq_status(task, cb);
@@ -1365,11 +1366,11 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
13651366
* (sequence ID, cached reply) MUST NOT change.
13661367
*/
13671368
++session->se_cb_seq_nr[cb->cb_held_slot];
1369+
ret = true;
13681370
break;
13691371
case -ESERVERFAULT:
13701372
++session->se_cb_seq_nr[cb->cb_held_slot];
13711373
nfsd4_mark_cb_fault(cb->cb_clp);
1372-
ret = false;
13731374
break;
13741375
case 1:
13751376
/*
@@ -1381,13 +1382,11 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
13811382
fallthrough;
13821383
case -NFS4ERR_BADSESSION:
13831384
nfsd4_mark_cb_fault(cb->cb_clp);
1384-
ret = false;
1385-
goto need_restart;
1385+
goto requeue;
13861386
case -NFS4ERR_DELAY:
13871387
cb->cb_seq_status = 1;
13881388
if (!rpc_restart_call(task))
13891389
goto out;
1390-
13911390
rpc_delay(task, 2 * HZ);
13921391
return false;
13931392
case -NFS4ERR_BADSLOT:
@@ -1405,14 +1404,13 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
14051404
nfsd41_cb_release_slot(cb);
14061405

14071406
if (RPC_SIGNALLED(task))
1408-
goto need_restart;
1407+
goto requeue;
14091408
out:
14101409
return ret;
14111410
retry_nowait:
1412-
if (rpc_restart_call_prepare(task))
1413-
ret = false;
1411+
rpc_restart_call_prepare(task);
14141412
goto out;
1415-
need_restart:
1413+
requeue:
14161414
if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
14171415
trace_nfsd_cb_restart(clp, cb);
14181416
task->tk_status = 0;

0 commit comments

Comments
 (0)