Skip to content

Commit 6c1cefb

Browse files
jtlaytonchucklever
authored andcommitted
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@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 1c2d095 commit 6c1cefb

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

fs/nfsd/nfs4callback.c

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,17 @@ static bool nfsd4_queue_cb(struct nfsd4_callback *cb)
10641064
return queue_work(clp->cl_callback_wq, &cb->cb_work);
10651065
}
10661066

1067+
static void nfsd4_requeue_cb(struct rpc_task *task, struct nfsd4_callback *cb)
1068+
{
1069+
struct nfs4_client *clp = cb->cb_clp;
1070+
1071+
if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
1072+
trace_nfsd_cb_restart(clp, cb);
1073+
task->tk_status = 0;
1074+
cb->cb_need_restart = true;
1075+
}
1076+
}
1077+
10671078
static void nfsd41_cb_inflight_begin(struct nfs4_client *clp)
10681079
{
10691080
atomic_inc(&clp->cl_cb_inflight);
@@ -1331,26 +1342,9 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
13311342
/* Returns true if CB_COMPOUND processing should continue */
13321343
static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback *cb)
13331344
{
1334-
struct nfs4_client *clp = cb->cb_clp;
1335-
struct nfsd4_session *session = clp->cl_cb_session;
1345+
struct nfsd4_session *session = cb->cb_clp->cl_cb_session;
13361346
bool ret = false;
13371347

1338-
if (!clp->cl_minorversion) {
1339-
/*
1340-
* If the backchannel connection was shut down while this
1341-
* task was queued, we need to resubmit it after setting up
1342-
* a new backchannel connection.
1343-
*
1344-
* Note that if we lost our callback connection permanently
1345-
* the submission code will error out, so we don't need to
1346-
* handle that case here.
1347-
*/
1348-
if (RPC_SIGNALLED(task))
1349-
goto requeue;
1350-
1351-
return true;
1352-
}
1353-
13541348
if (cb->cb_held_slot < 0)
13551349
goto requeue;
13561350

@@ -1411,11 +1405,7 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
14111405
rpc_restart_call_prepare(task);
14121406
goto out;
14131407
requeue:
1414-
if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
1415-
trace_nfsd_cb_restart(clp, cb);
1416-
task->tk_status = 0;
1417-
cb->cb_need_restart = true;
1418-
}
1408+
nfsd4_requeue_cb(task, cb);
14191409
return false;
14201410
}
14211411

@@ -1426,8 +1416,21 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
14261416

14271417
trace_nfsd_cb_rpc_done(clp);
14281418

1429-
if (!nfsd4_cb_sequence_done(task, cb))
1419+
if (!clp->cl_minorversion) {
1420+
/*
1421+
* If the backchannel connection was shut down while this
1422+
* task was queued, we need to resubmit it after setting up
1423+
* a new backchannel connection.
1424+
*
1425+
* Note that if we lost our callback connection permanently
1426+
* the submission code will error out, so we don't need to
1427+
* handle that case here.
1428+
*/
1429+
if (RPC_SIGNALLED(task))
1430+
nfsd4_requeue_cb(task, cb);
1431+
} else if (!nfsd4_cb_sequence_done(task, cb)) {
14301432
return;
1433+
}
14311434

14321435
if (cb->cb_status) {
14331436
WARN_ONCE(task->tk_status,

0 commit comments

Comments
 (0)