There isn't a common helper for getattrs, so add these into the protocol-spefici helpers. Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx> --- fs/nfsd/nfs3proc.c | 2 ++ fs/nfsd/nfs4proc.c | 2 ++ fs/nfsd/nfsproc.c | 3 +++ fs/nfsd/trace.h | 24 ++++++++++++++++++++++++ fs/nfsd/vfs.c | 2 ++ 5 files changed, 33 insertions(+) diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index 5d2b081072e8c2e286c6815c34e5e58d4be15067..c77e273e73a423c77047ff68126556ed36bc9c8e 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -70,6 +70,8 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp) struct nfsd_fhandle *argp = rqstp->rq_argp; struct nfsd3_attrstat *resp = rqstp->rq_resp; + trace_nfsd_vfs_getattr(rqstp, &argp->fh); + dprintk("nfsd: GETATTR(3) %s\n", SVCFH_fmt(&argp->fh)); diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 6e4c9bd15a6c820806832db19682e32a3d86507e..15508d2f5209b92fc62afb43ba03e72f195c2f77 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -923,6 +923,8 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_getattr *getattr = &u->getattr; __be32 status; + trace_nfsd_vfs_getattr(rqstp, &cstate->current_fh); + status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP); if (status) return status; diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 5d842671fe6fb36a24799de6991c0e21a883fb52..dd6ad6c87b55b3c830b81a7beda10d674dc0d09c 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -10,6 +10,7 @@ #include "cache.h" #include "xdr.h" #include "vfs.h" +#include "trace.h" #define NFSDDBG_FACILITY NFSDDBG_PROC @@ -54,6 +55,8 @@ nfsd_proc_getattr(struct svc_rqst *rqstp) struct nfsd_fhandle *argp = rqstp->rq_argp; struct nfsd_attrstat *resp = rqstp->rq_resp; + trace_nfsd_vfs_getattr(rqstp, &argp->fh); + dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); fh_copy(&resp->fh, &argp->fh); diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index 6f73ecc6bbf09cc174a93ce1dce12edfff6f60b8..29b391c66ff0f0eaa0bb06b2ab9063a2b9831171 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -2531,6 +2531,30 @@ TRACE_EVENT(nfsd_vfs_readdir, TP_printk("xid=0x%08x fh_hash=0x%08x offset=0x%llx", __entry->xid, __entry->fh_hash, __entry->offset) ); + +DECLARE_EVENT_CLASS(nfsd_vfs_getattr_class, + TP_PROTO(struct svc_rqst *rqstp, + struct svc_fh *fhp), + TP_ARGS(rqstp, fhp), + TP_STRUCT__entry( + SVC_RQST_ENDPOINT_FIELDS(rqstp) + __field(u32, fh_hash) + ), + TP_fast_assign( + SVC_RQST_ENDPOINT_ASSIGNMENTS(rqstp); + __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); + ), + TP_printk("xid=0x%08x fh_hash=0x%08x", + __entry->xid, __entry->fh_hash) +); + +#define DEFINE_NFSD_VFS_GETATTR_EVENT(__name) \ + DEFINE_EVENT(nfsd_vfs_getattr_class, __name, \ + TP_PROTO(struct svc_rqst *rqstp, struct svc_fh *fhp), \ + TP_ARGS(rqstp, fhp)) + +DEFINE_NFSD_VFS_GETATTR_EVENT(nfsd_vfs_getattr); +DEFINE_NFSD_VFS_GETATTR_EVENT(nfsd_vfs_statfs); #endif /* _NFSD_TRACE_H */ #undef TRACE_INCLUDE_PATH diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index ec07e5867912bf87497b935d26e3039364596864..f5ba30cb4b9358552c8f537ac5c7e5b733f57ffa 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -2317,6 +2317,8 @@ nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat, in { __be32 err; + trace_nfsd_vfs_statfs(rqstp, fhp); + err = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP | access); if (!err) { struct path path = { -- 2.49.0