Record the set of attributes requested by an NFSv4 client in an NFSv4 GETATTR request. nfsd-1034 [002] 164.067026: nfsd_get_fattr4: xid=0xcb4c4e33 bm[0]=TYPE|CHANGE|SIZE|FSID|FILEID bm[1]=MODE|NUMLINKS|OWNER|OWNER_GROUP|RAWDEV|SPACE_USED|TIME_ACCESS|TIME_METADATA|TIME_MODIFY|MOUNTED_ON_FILEID bm[2]= Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> --- fs/nfsd/nfs4proc.c | 2 + fs/nfsd/trace.h | 26 +++++++++++++++ include/trace/events/nfs.h | 75 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index e378aa91ba46..065ed5930250 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -706,6 +706,8 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_getattr *getattr = &u->getattr; __be32 status; + trace_nfsd4_getattr(rqstp, getattr->ga_bmval); + status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP); if (status) return status; diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index c2e72b880e6a..4fb668257ce2 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -564,6 +564,32 @@ TRACE_EVENT(nfsd4_fh_current, ) ); +TRACE_EVENT(nfsd4_getattr, + TP_PROTO( + const struct svc_rqst *rqstp, + const u32 *bitmask + ), + TP_ARGS(rqstp, bitmask), + TP_STRUCT__entry( + __field(u32, xid) + __field(unsigned long, bm0) + __field(unsigned long, bm1) + __field(unsigned long, bm2) + ), + TP_fast_assign( + __entry->xid = be32_to_cpu(rqstp->rq_xid); + __entry->bm0 = bitmask[0]; + __entry->bm1 = bitmask[1]; + __entry->bm2 = bitmask[2]; + ), + TP_printk("xid=0x%08x bm[0]=%s bm[1]=%s bm[2]=%s", + __entry->xid, + show_nfs4_fattr4_bm_word0(__entry->bm0), + show_nfs4_fattr4_bm_word1(__entry->bm1), + show_nfs4_fattr4_bm_word2(__entry->bm2) + ) +); + #include "state.h" #include "filecache.h" #include "vfs.h" diff --git a/include/trace/events/nfs.h b/include/trace/events/nfs.h index a152ed94e538..19f7444e4bb2 100644 --- a/include/trace/events/nfs.h +++ b/include/trace/events/nfs.h @@ -388,3 +388,78 @@ TRACE_DEFINE_ENUM(SP4_SSV); { NFS4_CDFC4_BACK, "BACK" }, \ { NFS4_CDFC4_FORE_OR_BOTH, "FORE_OR_BOTH" }, \ { NFS4_CDFC4_BACK_OR_BOTH, "BACK_OR_BOTH" }) + +#define show_nfs4_fattr4_bm_word0(x) \ + __print_flags(x, "|", \ + { FATTR4_WORD0_SUPPORTED_ATTRS, "SUPPORTED_ATTRS" }, \ + { FATTR4_WORD0_TYPE, "TYPE" }, \ + { FATTR4_WORD0_FH_EXPIRE_TYPE, "FH_EXPIRE_TYPE" }, \ + { FATTR4_WORD0_CHANGE, "CHANGE" }, \ + { FATTR4_WORD0_SIZE, "SIZE" }, \ + { FATTR4_WORD0_LINK_SUPPORT, "LINK_SUPPORT" }, \ + { FATTR4_WORD0_SYMLINK_SUPPORT, "SYMLINK_SUPPORT" }, \ + { FATTR4_WORD0_NAMED_ATTR, "NAMED_ATTR" }, \ + { FATTR4_WORD0_FSID, "FSID" }, \ + { FATTR4_WORD0_UNIQUE_HANDLES, "UNIQUE_HANDLES" }, \ + { FATTR4_WORD0_LEASE_TIME, "LEASE_TIME" }, \ + { FATTR4_WORD0_RDATTR_ERROR, "RDATTR_ERROR" }, \ + { FATTR4_WORD0_ACL, "ACL" }, \ + { FATTR4_WORD0_ACLSUPPORT, "ACLSUPPORT" }, \ + { FATTR4_WORD0_ARCHIVE, "ARCHIVE" }, \ + { FATTR4_WORD0_CANSETTIME, "CANSETTIME" }, \ + { FATTR4_WORD0_CASE_INSENSITIVE, "CASE_INSENSITIVE" }, \ + { FATTR4_WORD0_CASE_PRESERVING, "CASE_PRESERVING" }, \ + { FATTR4_WORD0_CHOWN_RESTRICTED, "CHOWN_RESTRICTED" }, \ + { FATTR4_WORD0_FILEHANDLE, "FILEHANDLE" }, \ + { FATTR4_WORD0_FILEID, "FILEID" }, \ + { FATTR4_WORD0_FILES_AVAIL, "FILES_AVAIL" }, \ + { FATTR4_WORD0_FILES_FREE, "FILES_FREE" }, \ + { FATTR4_WORD0_FILES_TOTAL, "FILES_TOTAL" }, \ + { FATTR4_WORD0_FS_LOCATIONS, "FS_LOCATIONS" }, \ + { FATTR4_WORD0_HIDDEN, "HIDDEN" }, \ + { FATTR4_WORD0_HOMOGENEOUS, "HOMOGENEOUS" }, \ + { FATTR4_WORD0_MAXFILESIZE, "MAXFILESIZE" }, \ + { FATTR4_WORD0_MAXLINK, "MAXLINK" }, \ + { FATTR4_WORD0_MAXNAME, "MAXNAME" }, \ + { FATTR4_WORD0_MAXREAD, "MAXREAD" }, \ + { FATTR4_WORD0_MAXWRITE, "MAXWRITE" }) + +#define show_nfs4_fattr4_bm_word1(x) \ + __print_flags(x, "|", \ + { FATTR4_WORD1_MIMETYPE, "MIMETYPE" }, \ + { FATTR4_WORD1_MODE, "MODE" }, \ + { FATTR4_WORD1_NO_TRUNC, "NO_TRUNC" }, \ + { FATTR4_WORD1_NUMLINKS, "NUMLINKS" }, \ + { FATTR4_WORD1_OWNER, "OWNER" }, \ + { FATTR4_WORD1_OWNER_GROUP, "OWNER_GROUP" }, \ + { FATTR4_WORD1_QUOTA_HARD, "QUOTA_HARD" }, \ + { FATTR4_WORD1_QUOTA_SOFT, "QUOTA_SOFT" }, \ + { FATTR4_WORD1_QUOTA_USED, "QUOTA_USED" }, \ + { FATTR4_WORD1_RAWDEV, "RAWDEV" }, \ + { FATTR4_WORD1_SPACE_AVAIL, "SPACE_AVAIL" }, \ + { FATTR4_WORD1_SPACE_FREE, "SPACE_FREE" }, \ + { FATTR4_WORD1_SPACE_TOTAL, "SPACE_TOTAL" }, \ + { FATTR4_WORD1_SPACE_USED, "SPACE_USED" }, \ + { FATTR4_WORD1_SYSTEM, "SYSTEM" }, \ + { FATTR4_WORD1_TIME_ACCESS, "TIME_ACCESS" }, \ + { FATTR4_WORD1_TIME_ACCESS_SET, "TIME_ACCESS_SET" }, \ + { FATTR4_WORD1_TIME_BACKUP, "TIME_BACKUP" }, \ + { FATTR4_WORD1_TIME_CREATE, "TIME_CREATE" }, \ + { FATTR4_WORD1_TIME_DELTA, "TIME_DELTA" }, \ + { FATTR4_WORD1_TIME_METADATA, "TIME_METADATA" }, \ + { FATTR4_WORD1_TIME_MODIFY, "TIME_MODIFY" }, \ + { FATTR4_WORD1_TIME_MODIFY_SET, "TIME_MODIFY_SET" }, \ + { FATTR4_WORD1_MOUNTED_ON_FILEID, "MOUNTED_ON_FILEID" }, \ + { FATTR4_WORD1_FS_LAYOUT_TYPES, "FS_LAYOUT_TYPES" }) + +#define show_nfs4_fattr4_bm_word2(x) \ + __print_flags(x, "|", \ + { FATTR4_WORD2_LAYOUT_TYPES, "LAYOUT_TYPES" }, \ + { FATTR4_WORD2_LAYOUT_BLKSIZE, "LAYOUT_BLKSIZE" }, \ + { FATTR4_WORD2_MDSTHRESHOLD, "MDSTHRESHOLD" }, \ + { FATTR4_WORD2_SUPPATTR_EXCLCREAT, "SUPPATTR_EXCLCREAT" }, \ + { FATTR4_WORD2_CLONE_BLKSIZE, "CLONE_BLKSIZE" }, \ + { FATTR4_WORD2_CHANGE_ATTR_TYPE, "CHANGE_ATTR_TYPE" }, \ + { FATTR4_WORD2_SECURITY_LABEL, "SECURITY_LABEL" }, \ + { FATTR4_WORD2_MODE_UMASK, "MODE_UMASK" }, \ + { FATTR4_WORD2_XATTR_SUPPORT, "XATTR_SUPPORT" })