nfsd: update callback done processing
Subsystems (2)
PATCH 1/1 nfsd: update callback done processing
Instead of having the convention where individual nfsd4_callback_ops->done operations return -1 to indicate the callback path is down, move the check to nfsd4_cb_done. Only mark the callback path down on transport-level errors, not NFS-level errors.
Additionally, handle NFS4ERR_DELAY in nfsd4_cb_recall_done. The client returns NFS4ERR_DELAY if it is already in the process of returning the delegation.
--- fs/nfsd/nfs4callback.c | 9 +++++---- fs/nfsd/nfs4layouts.c | 2 +- fs/nfsd/nfs4state.c | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-)
fs/nfsd/nfs4callback.c +5 -4
@@ -1122,10 +1122,11 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)rpc_restart_call_prepare (task);return ;case 1 : -break ; -case -1 : -/* Network partition? */ -nfsd4_mark_cb_down (clp, task->tk_status); +switch (task->tk_status) { +case -EIO : +case -ETIMEDOUT : +nfsd4_mark_cb_down (clp, task->tk_status); + }break ;default :BUG ();
fs/nfsd/nfs4layouts.c +1 -1
@@ -693,7 +693,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task) ops->fence_client (ls); elsenfsd4_cb_layout_fail (ls ); -return -1 ; +return 1 ;case -NFS4ERR_NOMATCHING_LAYOUT :trace_nfsd_layout_recall_done (&ls->ls_stid.sc_stateid); task->tk_status =0 ;
fs/nfsd/nfs4state.c +4 -1
@@ -3957,6 +3957,9 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,switch (task->tk_status) {case 0 :return 1 ; +case -NFS4ERR_DELAY : +rpc_delay (task,2 *HZ ); +return 0 ;case -EBADHANDLE :case -NFS4ERR_BAD_STATEID :/*
@@ -3969,7 +3972,7 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb, }/*FALLTHRU*/ default : -return -1 ; +return 1 ; } }
Signature · 1 line
2.17.2
Thanks, looks good! Added one more paragraph with what you'd originally seen (see below), and applied for 5.2.
I haven't added a stable cc, since I didn't think you'd established that this in itself was causing a major problem--tell me if I'm wrong.
--b.
commit 1c73b9d24f80
Author: Scott Mayhew <[email protected]> Date: Thu May 2 13:32:12 2019 -0400
nfsd: update callback done processing
Instead of having the convention where individual nfsd4_callback_ops->done operations return -1 to indicate the callback path is down, move the check to nfsd4_cb_done. Only mark the callback path down on transport-level errors, not NFS-level errors.
The existing logic causes the server to set SEQ4_STATUS_CB_PATH_DOWN just because the client returned an error to a CB_RECALL for a delegation that the client had already done a FREE_STATEID for. But clearly that error doesn't mean that there's anything wrong with the backchannel.
Additionally, handle NFS4ERR_DELAY in nfsd4_cb_recall_done. The client returns NFS4ERR_DELAY if it is already in the process of returning the delegation.
fs/nfsd/nfs4callback.c +5 -4
@@ -1122,10 +1122,11 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)rpc_restart_call_prepare (task);return ;case 1 : -break ; -case -1 : -/* Network partition? */ -nfsd4_mark_cb_down (clp, task->tk_status); +switch (task->tk_status) { +case -EIO : +case -ETIMEDOUT : +nfsd4_mark_cb_down (clp, task->tk_status); + }break ;default :BUG ();
fs/nfsd/nfs4layouts.c +1 -1
@@ -693,7 +693,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task) ops->fence_client (ls); elsenfsd4_cb_layout_fail (ls ); -return -1 ; +return 1 ;case -NFS4ERR_NOMATCHING_LAYOUT :trace_nfsd_layout_recall_done (&ls->ls_stid.sc_stateid); task->tk_status =0 ;
fs/nfsd/nfs4state.c +4 -1
@@ -3970,6 +3970,9 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,switch (task->tk_status) {case 0 :return 1 ; +case -NFS4ERR_DELAY : +rpc_delay (task,2 *HZ ); +return 0 ;case -EBADHANDLE :case -NFS4ERR_BAD_STATEID :/*
@@ -3982,7 +3985,7 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb, }/*FALLTHRU*/ default : -return -1 ; +return 1 ; } }