Record the stateid being processed by each COMPOUND. nfsd-1033 [003] 165.199589: nfsd_stateid_prep: xid=0xeb2d9610 client 5f4fdc70:dbdb3569 stateid 00000001:00000002 status=0 Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> --- fs/nfsd/nfs4state.c | 24 ++++++++++++++---------- fs/nfsd/trace.h | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f101202ed536..0cc928328c22 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -5881,12 +5881,14 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, if (nfp) *nfp = NULL; - if (grace_disallows_io(net, ino)) - return nfserr_grace; + if (grace_disallows_io(net, ino)) { + status = nfserr_grace; + goto out; + } if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) { status = check_special_stateids(net, fhp, stateid, flags); - goto done; + goto out_check; } status = nfsd4_lookup_stateid(cstate, stateid, @@ -5895,11 +5897,11 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, if (status == nfserr_bad_stateid) status = find_cpntf_state(nn, stateid, &s); if (status) - return status; + goto out; status = nfsd4_stid_check_stateid_generation(stateid, s, nfsd4_has_session(cstate)); if (status) - goto out; + goto out_put; switch (s->sc_type) { case NFS4_DELEG_STID: @@ -5914,19 +5916,21 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, break; } if (status) - goto out; + goto out_put; status = nfs4_check_fh(fhp, s); -done: +out_check: if (status == nfs_ok && nfp) status = nfs4_check_file(rqstp, fhp, s, nfp, flags); -out: +out_put: if (s) { if (!status && cstid) *cstid = s; else nfs4_put_stid(s); } +out: + trace_nfsd4_stateid_prep(rqstp, stateid, status); return status; } @@ -6066,7 +6070,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, struct nfs4_stid *s; struct nfs4_ol_stateid *stp = NULL; - trace_nfsd_preprocess(seqid, stateid); + trace_nfsd4_seqid_prep(seqid, stateid); *stpp = NULL; status = nfsd4_lookup_stateid(cstate, stateid, typemask, &s, nn); @@ -6135,7 +6139,7 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, oo->oo_flags |= NFS4_OO_CONFIRMED; nfs4_inc_and_copy_stateid(&oc->oc_resp_stateid, &stp->st_stid); mutex_unlock(&stp->st_mutex); - trace_nfsd_open_confirm(oc->oc_seqid, &stp->st_stid.sc_stateid); + trace_nfsd4_open_confirm(oc->oc_seqid, &stp->st_stid.sc_stateid); nfsd4_client_record_create(oo->oo_owner.so_client); status = nfs_ok; put_stateid: diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index 48250610dfa4..fc58e1a3ef60 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -349,6 +349,35 @@ DEFINE_NFSD_ERR_EVENT(write_err); #include "filecache.h" #include "vfs.h" +TRACE_EVENT(nfsd4_stateid_prep, + TP_PROTO( + const struct svc_rqst *rqstp, + const stateid_t *stp, + __be32 status + ), + TP_ARGS(rqstp, stp, status), + TP_STRUCT__entry( + __field(u32, xid) + __field(u32, cl_boot) + __field(u32, cl_id) + __field(u32, si_id) + __field(u32, si_generation) + __field(int, status) + ), + 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; + __entry->status = be32_to_cpu(status); + ), + TP_printk("xid=0x%08x client %08x:%08x stateid %08x:%08x status=%d", + __entry->xid, __entry->cl_boot, __entry->cl_id, + __entry->si_id, __entry->si_generation, __entry->status + ) +); + DECLARE_EVENT_CLASS(nfsd_stateid_class, TP_PROTO(stateid_t *stp), TP_ARGS(stp), @@ -415,11 +444,11 @@ DECLARE_EVENT_CLASS(nfsd_stateseqid_class, ) #define DEFINE_STATESEQID_EVENT(name) \ -DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \ +DEFINE_EVENT(nfsd_stateseqid_class, nfsd4_##name, \ TP_PROTO(u32 seqid, const stateid_t *stp), \ TP_ARGS(seqid, stp)) -DEFINE_STATESEQID_EVENT(preprocess); +DEFINE_STATESEQID_EVENT(seqid_prep); DEFINE_STATESEQID_EVENT(open_confirm); DECLARE_EVENT_CLASS(nfsd_clientid_class,