nfsd: fix nfsd4_cb_recall_done error handling
Subsystems (2)
RFC PATCH 1/1 nfsd: fix nfsd4_cb_recall_done error handling
The error handling for CB_RECALL seems fairly broken to me.
What looks good:
- for EBADHANDLE and NFS4ERR_BAD_STATEID retry until dl_retries hits zero, then mark the connection down and set cb_done
What looks wrong:
- for everything else we first mark the connection down, then retry until dl_retries hits zero, then mark the connection down again and set cb_done.
Quoted 1 line
From all I can see what we want is:
- keep the behavior for EBADHANDLE and NFS4ERR_BAD_STATEID, otherwise jump straight to making the connection down and setting cb_done
But maybe I'm missing something?
fs/nfsd/nfs4callback.c +7 -10
@@ -971,24 +971,21 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)return ;switch (task->tk_status) {case 0 : - cb->cb_done = true; -return ; +break ;case -EBADHANDLE :case -NFS4ERR_BAD_STATEID :/* Race: client probably got cb_recall * before open reply granting delegation */ -break ; +if (dp->dl_retries--) { +rpc_delay (task,2 *HZ ); + task->tk_status =0 ; +rpc_restart_call_prepare (task); +return ; + }default :/* Network partition? */ nfsd4_mark_cb_down (clp, task->tk_status); } -if (dp->dl_retries--) { -rpc_delay (task,2 *HZ ); - task->tk_status =0 ; -rpc_restart_call_prepare (task); -return ; - } -nfsd4_mark_cb_down (clp, task->tk_status); cb->cb_done = true; }
Signature · 1 line
1.9.1
Quoted 49 lines · Christoph Hellwig
The error handling for
CB_RECALLseems fairly broken to me.What looks good:
- for EBADHANDLE and
NFS4ERR_BAD_STATEIDretry untildl_retrieshits zero, then mark the connection down and setcb_doneWhat looks wrong:
- for everything else we first mark the connection down, then retry until
dl_retrieshits zero, then mark the connection down again and setcb_done.From all I can see what we want is:
- keep the behavior for EBADHANDLE and
NFS4ERR_BAD_STATEID, otherwise jump straight to making the connection down and settingcb_doneBut maybe I'm missing something?
fs/nfsd/nfs4callback.c +7
-3@@ -971,24 +971,21 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)return ;switch (task->tk_status) {case 0 : - cb->cb_done = true; -return ; +break ;case -EBADHANDLE :case -NFS4ERR_BAD_STATEID :/* Race: client probably got cb_recall * before open reply granting delegation */ -break ; +if (dp->dl_retries--) { +rpc_delay (task,2 *HZ ); + task->tk_status =0 ; +rpc_restart_call_prepare (task); +return ; + }default :/* Network partition? */ nfsd4_mark_cb_down (clp, task->tk_status); }
fs/nfsd/nfs4callback.c static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata) · line 991
Quoted 10 lines
fs/nfsd/nfs4callback.c +0
-7-if (dp->dl_retries--) { -rpc_delay (task,2 *HZ ); - task->tk_status =0 ; -rpc_restart_call_prepare (task); -return ; - } -nfsd4_mark_cb_down (clp, task->tk_status); cb->cb_done = true; }
We're also missing a handler for NFS4ERR_DELAY, which is listed as a legal response to CB_RECALL in both RFC5661 and RFC3530bis. As far as I can tell from the above, knfsd will currently take that to be a sign it should mark the callback path as being down...
Signature · 5 lines
Trond Myklebust Linux NFS client maintainer, PrimaryData [email protected]
Quoted 4 lines · Trond Myklebust
We're also missing a handler for
NFS4ERR_DELAY, which is listed as a legal response toCB_RECALLin both RFC5661 and RFC3530bis. As far as I can tell from the above, knfsd will currently take that to be a sign it should mark the callback path as being down...
Yes. I've got a fix of that further down in my queue with the pnfs patches, just wanted to set this bit out first.
I plan to handle NFS4ERR_DELAY in the generic callback layer instead of burderning it onto the individual callback implementations.
Quoted 13 lines · Christoph Hellwig
The error handling for
CB_RECALLseems fairly broken to me.What looks good:
- for EBADHANDLE and
NFS4ERR_BAD_STATEIDretry untildl_retrieshits zero, then mark the connection down and setcb_doneWhat looks wrong:
- for everything else we first mark the connection down, then retry until
dl_retrieshits zero, then mark the connection down again and setcb_done.
Quoted 7 lines
Quoted 1 line
From all I can see what we want is:
- keep the behavior for EBADHANDLE and
NFS4ERR_BAD_STATEID, otherwise jump straight to making the connection down and settingcb_doneBut maybe I'm missing something?
I can't think of anything; let me know when you want something applied.
--b.
Quoted 45 lines
fs/nfsd/nfs4callback.c +7
-10@@ -971,24 +971,21 @@ static void nfsd4_cb_recall_done(struct rpc_task *task, void *calldata)return ;switch (task->tk_status) {case 0 : - cb->cb_done = true; -return ; +break ;case -EBADHANDLE :case -NFS4ERR_BAD_STATEID :/* Race: client probably got cb_recall * before open reply granting delegation */ -break ; +if (dp->dl_retries--) { +rpc_delay (task,2 *HZ ); + task->tk_status =0 ; +rpc_restart_call_prepare (task); +return ; + }default :/* Network partition? */ nfsd4_mark_cb_down (clp, task->tk_status); } -if (dp->dl_retries--) { -rpc_delay (task,2 *HZ ); - task->tk_status =0 ; -rpc_restart_call_prepare (task); -return ; - } -nfsd4_mark_cb_down (clp, task->tk_status); cb->cb_done = true; }Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html