nfsd: don't call trace_nfsd_deleg_none() if read delegation is given
Subsystems (2)
PATCH 1/1 nfsd: don't call trace_nfsd_deleg_none() if read delegation is given
Don't call trace_nfsd_deleg_none() if read delegation is given, else two exclusive traces will be printed:
nfsd_deleg_open: client 5f45b854:e6058001 stateid 00000030:00000001
nfsd_deleg_none: client 5f45b854:e6058001 stateid 0000002f:00000001Fix it by calling trace_nfsd_deleg_none() directly in appropriate places instead of calling it by checking the value of op_delegate_type.
Also remove the unnecessary assignment "status = nfs_ok", because we can ensure status will be nfs_ok after the call of nfs4_inc_and_copy_stateid().
--- fs/nfsd/nfs4state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/nfsd/nfs4state.c +4 -4
@@ -5131,6 +5131,8 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open,nfs4_put_stid (&dp->dl_stid);return ; out_no_deleg: +trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); + open->op_delegate_type =NFS4_OPEN_DELEGATE_NONE ;if (open->op_claim_type ==NFS4_OPEN_CLAIM_PREVIOUS && open->op_delegate_type !=NFS4_OPEN_DELEGATE_NONE ) {
@@ -5232,7 +5234,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfif (open->op_deleg_want &NFS4_SHARE_WANT_NO_DELEG ) { open->op_delegate_type =NFS4_OPEN_DELEGATE_NONE_EXT ; open->op_why_no_deleg =WND4_NOT_WANTED ; - goto nodeleg; +trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); + goto out; } }
@@ -5241,9 +5244,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf* OPEN succeeds even if we fail. */ nfs4_open_delegation (current_fh, open, stp); -nodeleg: - status = nfs_ok; -trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); out:/* 4.1 client trying to upgrade/downgrade delegation? */ if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&
Signature · 1 line
2.25.0.4.g0ad7144999
Hello!
Quoted 7 lines · Hou Tao
Don't call
trace_nfsd_deleg_none()if read delegation is given, else two exclusive traces will be printed:nfsd_deleg_open: client 5f45b854:e6058001 stateid 00000030:00000001 nfsd_deleg_none: client 5f45b854:e6058001 stateid 0000002f:00000001
These are reporting two different state IDs: the first is a delegation state ID, and the second is an open state ID.
So in the "no delegation" case, we want to see just the open state ID. In the "delegation" case, we do want to see both.
You could argue (successfully) that the names of the tracepoints are pretty lousy. Maybe better to rename:
nfsd_deleg_open -> nfsd_deleg_read
nfsd_deleg_none -> nfsd_open
What do you think?
Quoted 43 lines
Fix it by calling
trace_nfsd_deleg_none()directly in appropriate places instead of calling it by checking the value ofop_delegate_type.Also remove the unnecessary assignment "status =
nfs_ok", because we can ensure status will benfs_okafter the call ofnfs4_inc_and_copy_stateid().Signed-off-by Hou Tao <[email protected]>---
fs/nfsd/nfs4state.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)fs/nfsd/nfs4state.c +0
-0@@ -5131,6 +5131,8 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open,nfs4_put_stid (&dp->dl_stid);return ;
out_no_deleg:fs/nfsd/nfs4state.c +2
-0+trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); +open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE; if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS && open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) {fs/nfsd/nfs4state.c +2
-4@@ -5232,7 +5234,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfif (open->op_deleg_want &NFS4_SHARE_WANT_NO_DELEG ) { open->op_delegate_type =NFS4_OPEN_DELEGATE_NONE_EXT ; open->op_why_no_deleg =WND4_NOT_WANTED ; - goto nodeleg; +trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); + goto out; } }@@ -5241,9 +5244,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf* OPEN succeeds even if we fail. */ nfs4_open_delegation (current_fh, open, stp); -nodeleg: - status = nfs_ok; -trace_nfsd_deleg_none (&stp->st_stid.sc_stateid);out:
Quoted 5 lines
/* 4.1 client trying to upgrade/downgrade delegation? */ if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&Signature · 1 line
2.25.0.4.g0ad7144999
--
Chuck Lever
Hi,
Quoted 7 lines · Chuck Lever
Hello!
Quoted 5 lines · Hou Tao
Don't call
trace_nfsd_deleg_none()if read delegation is given, else two exclusive traces will be printed:
Quoted 9 lines
Quoted 2 lines
nfsd_deleg_open: client 5f45b854:e6058001 stateid 00000030:00000001 nfsd_deleg_none: client 5f45b854:e6058001 stateid 0000002f:00000001These are reporting two different state IDs: the first is a delegation state ID, and the second is an open state ID.
So in the "no delegation" case, we want to see just the open state ID. In the "delegation" case, we do want to see both.
Thanks for your explanation.
Quoted 8 lines
You could argue (successfully) that the names of the tracepoints are pretty lousy. Maybe better to rename:
nfsd_deleg_open->nfsd_deleg_read
nfsd_deleg_none->nfsd_openWhat do you think?
After the renaming, the trace looks clearer. I will do it in v2.
Thanks
Quoted 56 lines
Quoted 43 lines
Fix it by calling
trace_nfsd_deleg_none()directly in appropriate places instead of calling it by checking the value ofop_delegate_type.Also remove the unnecessary assignment "status =
nfs_ok", because we can ensure status will benfs_okafter the call ofnfs4_inc_and_copy_stateid().Signed-off-by Hou Tao <[email protected]>---
fs/nfsd/nfs4state.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)fs/nfsd/nfs4state.c +0
-0@@ -5131,6 +5131,8 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open,nfs4_put_stid (&dp->dl_stid);return ;
out_no_deleg:fs/nfsd/nfs4state.c +2
-0+trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); +open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE; if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS && open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) {fs/nfsd/nfs4state.c +2
-4@@ -5232,7 +5234,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfif (open->op_deleg_want &NFS4_SHARE_WANT_NO_DELEG ) { open->op_delegate_type =NFS4_OPEN_DELEGATE_NONE_EXT ; open->op_why_no_deleg =WND4_NOT_WANTED ; - goto nodeleg; +trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); + goto out; } }@@ -5241,9 +5244,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf* OPEN succeeds even if we fail. */ nfs4_open_delegation (current_fh, open, stp); -nodeleg: - status = nfs_ok; -trace_nfsd_deleg_none (&stp->st_stid.sc_stateid);out:
Quoted 5 lines
/* 4.1 client trying to upgrade/downgrade delegation? */ if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&Signature · 1 line
2.25.0.4.g0ad7144999--
Chuck Lever.
PATCH v2 1/1 nfsd: rename delegation related tracepoints to make them less confusing
In reply to Chuck LeverNow when a read delegation is given, two delegation related traces will be printed:
nfsd_deleg_open: client 5f45b854:e6058001 stateid 00000030:00000001
nfsd_deleg_none: client 5f45b854:e6058001 stateid 0000002f:00000001Although the intention is to let developers know two stateid are returned, the traces are confusing about whether or not a read delegation is handled out. So renaming trace_nfsd_deleg_none() to trace_nfsd_open() and trace_nfsd_deleg_open() to trace_nfsd_deleg_read() to make the intension clearer.
The patched traces will be:
nfsd_deleg_read: client 5f48a967:b55b21cd stateid 00000003:00000001
nfsd_open: client 5f48a967:b55b21cd stateid 00000002:00000001---
v1: https://marc.info/?l=linux-nfs&m=159851134513236&w=2
fs/nfsd/nfs4state.c | 4 ++-- fs/nfsd/trace.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/nfsd/nfs4state.c +2 -2
@@ -5126,7 +5126,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open,memcpy (&open->op_delegate_stateid, &dp->dl_stid.sc_stateid,sizeof (dp->dl_stid.sc_stateid)); -trace_nfsd_deleg_open (&dp->dl_stid.sc_stateid); +trace_nfsd_deleg_read (&dp->dl_stid.sc_stateid); open->op_delegate_type =NFS4_OPEN_DELEGATE_READ ;nfs4_put_stid (&dp->dl_stid);return ;
@@ -5243,7 +5243,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfnfs4_open_delegation (current_fh, open, stp); nodeleg: status = nfs_ok; -trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); +trace_nfsd_open (&stp->st_stid.sc_stateid); out:/* 4.1 client trying to upgrade/downgrade delegation? */ if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&
fs/nfsd/trace.h +2 -2
@@ -289,8 +289,8 @@ DEFINE_STATEID_EVENT(layout_recall_done);DEFINE_STATEID_EVENT (layout_recall_fail);DEFINE_STATEID_EVENT (layout_recall_release); -DEFINE_STATEID_EVENT (deleg_open); -DEFINE_STATEID_EVENT (deleg_none); +DEFINE_STATEID_EVENT (open); +DEFINE_STATEID_EVENT (deleg_read);DEFINE_STATEID_EVENT (deleg_break);DEFINE_STATEID_EVENT (deleg_recall);
Signature · 1 line
2.25.0.4.g0ad7144999
Re: [PATCH v2] nfsd: rename delegation related tracepoints to make them less confusing
Quoted 16 lines · Hou Tao
Now when a read delegation is given, two delegation related traces will be printed:
nfsd_deleg_open: client 5f45b854:e6058001 stateid 00000030:00000001 nfsd_deleg_none: client 5f45b854:e6058001 stateid 0000002f:00000001Although the intention is to let developers know two stateid are returned, the traces are confusing about whether or not a read delegation is handled out. So renaming
trace_nfsd_deleg_none()totrace_nfsd_open()andtrace_nfsd_deleg_open()totrace_nfsd_deleg_read()to make the intension clearer.
Quoted 7 lines
The patched traces will be:
nfsd_deleg_read: client 5f48a967:b55b21cd stateid 00000003:00000001 nfsd_open: client 5f48a967:b55b21cd stateid 00000002:00000001Suggested-by Chuck Lever <[email protected]>Signed-off-by Hou Tao <[email protected]>
LGTM. I assume Bruce is taking this for v5.10.
Quoted 47 lines
---
v1: https://marc.info/?l=linux-nfs&m=159851134513236&w=2
fs/nfsd/nfs4state.c| 4 ++--fs/nfsd/trace.h| 4 ++--2 files changed, 4 insertions(+), 4 deletions(-)fs/nfsd/nfs4state.c +1
-1@@ -5126,7 +5126,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open,memcpy (&open->op_delegate_stateid, &dp->dl_stid.sc_stateid,sizeof (dp->dl_stid.sc_stateid)); -trace_nfsd_deleg_open (&dp->dl_stid.sc_stateid); +trace_nfsd_deleg_read (&dp->dl_stid.sc_stateid); open->op_delegate_type =NFS4_OPEN_DELEGATE_READ ;nfs4_put_stid (&dp->dl_stid);return ;@@ -5243,7 +5243,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfnfs4_open_delegation (current_fh, open, stp);nodeleg:
status = nfs_ok;fs/nfsd/nfs4state.c +1
-1-trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); +trace_nfsd_open (&stp->st_stid.sc_stateid);out:
/* 4.1 client trying to upgrade/downgrade delegation? */ if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&fs/nfsd/trace.h +2
-2@@ -289,8 +289,8 @@ DEFINE_STATEID_EVENT(layout_recall_done);DEFINE_STATEID_EVENT (layout_recall_fail);DEFINE_STATEID_EVENT (layout_recall_release); -DEFINE_STATEID_EVENT (deleg_open); -DEFINE_STATEID_EVENT (deleg_none); +DEFINE_STATEID_EVENT (open); +DEFINE_STATEID_EVENT (deleg_read);DEFINE_STATEID_EVENT (deleg_break);DEFINE_STATEID_EVENT (deleg_recall);Signature · 1 line
2.25.0.4.g0ad7144999
--
Chuck Lever
Re: [PATCH v2] nfsd: rename delegation related tracepoints to make them less confusing
Quoted 18 lines · Chuck Lever
Quoted 18 lines · Hou Tao
Now when a read delegation is given, two delegation related traces will be printed:
nfsd_deleg_open: client 5f45b854:e6058001 stateid 00000030:00000001 nfsd_deleg_none: client 5f45b854:e6058001 stateid 0000002f:00000001Although the intention is to let developers know two stateid are returned, the traces are confusing about whether or not a read delegation is handled out. So renaming
trace_nfsd_deleg_none()totrace_nfsd_open()andtrace_nfsd_deleg_open()totrace_nfsd_deleg_read()to make the intension clearer.The patched traces will be:
Quoted 7 lines
Quoted 5 lines
nfsd_deleg_read: client 5f48a967:b55b21cd stateid 00000003:00000001 nfsd_open: client 5f48a967:b55b21cd stateid 00000002:00000001Suggested-by Chuck Lever <[email protected]>Signed-off-by Hou Tao <[email protected]>LGTM. I assume Bruce is taking this for v5.10.
Applying for 5.10, thanks.--b.
Quoted 54 lines
Quoted 49 lines
---
v1: https://marc.info/?l=linux-nfs&m=159851134513236&w=2
fs/nfsd/nfs4state.c| 4 ++--fs/nfsd/trace.h| 4 ++--2 files changed, 4 insertions(+), 4 deletions(-)fs/nfsd/nfs4state.c +1
-1@@ -5126,7 +5126,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open,memcpy (&open->op_delegate_stateid, &dp->dl_stid.sc_stateid,sizeof (dp->dl_stid.sc_stateid)); -trace_nfsd_deleg_open (&dp->dl_stid.sc_stateid); +trace_nfsd_deleg_read (&dp->dl_stid.sc_stateid); open->op_delegate_type =NFS4_OPEN_DELEGATE_READ ;nfs4_put_stid (&dp->dl_stid);return ;@@ -5243,7 +5243,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfnfs4_open_delegation (current_fh, open, stp);nodeleg:
status = nfs_ok;fs/nfsd/nfs4state.c +1
-1-trace_nfsd_deleg_none (&stp->st_stid.sc_stateid); +trace_nfsd_open (&stp->st_stid.sc_stateid);out:
/* 4.1 client trying to upgrade/downgrade delegation? */ if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&fs/nfsd/trace.h +2
-2@@ -289,8 +289,8 @@ DEFINE_STATEID_EVENT(layout_recall_done);DEFINE_STATEID_EVENT (layout_recall_fail);DEFINE_STATEID_EVENT (layout_recall_release); -DEFINE_STATEID_EVENT (deleg_open); -DEFINE_STATEID_EVENT (deleg_none); +DEFINE_STATEID_EVENT (open); +DEFINE_STATEID_EVENT (deleg_read);DEFINE_STATEID_EVENT (deleg_break);DEFINE_STATEID_EVENT (deleg_recall);Signature · 1 line
2.25.0.4.g0ad7144999--
Chuck Lever