Record the stateid being returned to help troubleshoot problems with delegation. The status code is reported by the nfsd_compound_status tracepoint. nfsd-1035 [002] 75.873544: nfsd4_delegreturn: xid=0x6575fc16 client 5f68de0f:f04d8b16 stateid 0000005c:00000001 nfsd-1035 [002] 75.873574: nfsd_file_put: hash=0xac7 inode=0xffff8887050d7470 ref=1 flags=REFERENCED may=READ file=0xffff888717a79680 nfsd-1035 [002] 75.873575: nfsd_file_put_final: hash=0xac7 inode=0xffff8887050d7470 ref=0 flags=REFERENCED may=READ file=0xffff888717a79680 nfsd-1035 [002] 75.873601: nfsd4_compoundstatus: xid=0x6575fc16 op=4/4 OP_DELEGRETURN status=OK Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> --- fs/nfsd/nfs4state.c | 2 ++ fs/nfsd/trace.h | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 47790c7a29a3..992ac867e52e 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -6303,6 +6303,8 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, __be32 status; struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); + trace_nfsd4_delegreturn(rqstp, stateid); + if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) return status; diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index 18b359a04d96..234b4ea7a4c7 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -679,6 +679,32 @@ TRACE_EVENT(nfsd4_stateid_prep, ) ); +TRACE_EVENT(nfsd4_delegreturn, + TP_PROTO( + const struct svc_rqst *rqstp, + const stateid_t *stp + ), + TP_ARGS(rqstp, stp), + TP_STRUCT__entry( + __field(u32, xid) + __field(u32, cl_boot) + __field(u32, cl_id) + __field(u32, si_id) + __field(u32, si_generation) + ), + TP_fast_assign( + __entry->xid = be32_to_cpu(rqstp->rq_xid); + __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; + __entry->cl_id = stp->si_opaque.so_clid.cl_id; + __entry->si_id = stp->si_opaque.so_id; + __entry->si_generation = stp->si_generation; + ), + TP_printk("xid=0x%08x client %08x:%08x stateid %08x:%08x", + __entry->xid, __entry->cl_boot, __entry->cl_id, + __entry->si_id, __entry->si_generation + ) +); + DECLARE_EVENT_CLASS(nfsd_stateid_class, TP_PROTO(stateid_t *stp), TP_ARGS(stp),