[PATCH RFC 13/21] NFSD: Add GETATTR tracepoint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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    |  143 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 145 insertions(+)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index a718097b5330..6206ba7b1ac7 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 8da691b642ac..48250610dfa4 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -918,6 +918,149 @@ TRACE_EVENT(nfsd4_fh_current,
 		__entry->xid, __entry->fh_hash, __get_str(name))
 );
 
+/*
+ * from include/linux/nfs4.h
+ */
+#define FATTR4_WORD0_FLAGS					\
+	fattr4_word0_bit(SUPPORTED_ATTRS)			\
+	fattr4_word0_bit(TYPE)					\
+	fattr4_word0_bit(FH_EXPIRE_TYPE)			\
+	fattr4_word0_bit(CHANGE)				\
+	fattr4_word0_bit(SIZE)					\
+	fattr4_word0_bit(LINK_SUPPORT)				\
+	fattr4_word0_bit(SYMLINK_SUPPORT)			\
+	fattr4_word0_bit(NAMED_ATTR)				\
+	fattr4_word0_bit(FSID)					\
+	fattr4_word0_bit(UNIQUE_HANDLES)			\
+	fattr4_word0_bit(LEASE_TIME)				\
+	fattr4_word0_bit(RDATTR_ERROR)				\
+	fattr4_word0_bit(ACL)					\
+	fattr4_word0_bit(ACLSUPPORT)				\
+	fattr4_word0_bit(ARCHIVE)				\
+	fattr4_word0_bit(CANSETTIME)				\
+	fattr4_word0_bit(CASE_INSENSITIVE)			\
+	fattr4_word0_bit(CASE_PRESERVING)			\
+	fattr4_word0_bit(CHOWN_RESTRICTED)			\
+	fattr4_word0_bit(FILEHANDLE)				\
+	fattr4_word0_bit(FILEID)				\
+	fattr4_word0_bit(FILES_AVAIL)				\
+	fattr4_word0_bit(FILES_FREE)				\
+	fattr4_word0_bit(FILES_TOTAL)				\
+	fattr4_word0_bit(FS_LOCATIONS)				\
+	fattr4_word0_bit(HIDDEN)				\
+	fattr4_word0_bit(HOMOGENEOUS)				\
+	fattr4_word0_bit(MAXFILESIZE)				\
+	fattr4_word0_bit(MAXLINK)				\
+	fattr4_word0_bit(MAXNAME)				\
+	fattr4_word0_bit(MAXREAD)				\
+	fattr4_word0_bit_end(MAXWRITE)
+
+#undef fattr4_word0_bit
+#undef fattr4_word0_bit_end
+#define fattr4_word0_bit(x)		TRACE_DEFINE_ENUM(FATTR4_WORD0_##x);
+#define fattr4_word0_bit_end(x)		TRACE_DEFINE_ENUM(FATTR4_WORD0_##x);
+
+FATTR4_WORD0_FLAGS
+
+#undef fattr4_word0_bit
+#undef fattr4_word0_bit_end
+#define fattr4_word0_bit(x)		{ FATTR4_WORD0_##x, #x },
+#define fattr4_word0_bit_end(x)		{ FATTR4_WORD0_##x, #x }
+
+#define show_fattr4_bm_word0(x)	__print_flags(x, "|", FATTR4_WORD0_FLAGS)
+
+#define FATTR4_WORD1_FLAGS					\
+	fattr4_word1_bit(MIMETYPE)				\
+	fattr4_word1_bit(MODE)					\
+	fattr4_word1_bit(NO_TRUNC)				\
+	fattr4_word1_bit(NUMLINKS)				\
+	fattr4_word1_bit(OWNER)					\
+	fattr4_word1_bit(OWNER_GROUP)				\
+	fattr4_word1_bit(QUOTA_HARD)				\
+	fattr4_word1_bit(QUOTA_SOFT)				\
+	fattr4_word1_bit(QUOTA_USED)				\
+	fattr4_word1_bit(RAWDEV)				\
+	fattr4_word1_bit(SPACE_AVAIL)				\
+	fattr4_word1_bit(SPACE_FREE)				\
+	fattr4_word1_bit(SPACE_TOTAL)				\
+	fattr4_word1_bit(SPACE_USED)				\
+	fattr4_word1_bit(SYSTEM)				\
+	fattr4_word1_bit(TIME_ACCESS)				\
+	fattr4_word1_bit(TIME_ACCESS_SET)			\
+	fattr4_word1_bit(TIME_BACKUP)				\
+	fattr4_word1_bit(TIME_CREATE)				\
+	fattr4_word1_bit(TIME_DELTA)				\
+	fattr4_word1_bit(TIME_METADATA)				\
+	fattr4_word1_bit(TIME_MODIFY)				\
+	fattr4_word1_bit(TIME_MODIFY_SET)			\
+	fattr4_word1_bit(MOUNTED_ON_FILEID)			\
+	fattr4_word1_bit_end(FS_LAYOUT_TYPES)
+
+#undef fattr4_word1_bit
+#undef fattr4_word1_bit_end
+#define fattr4_word1_bit(x)		TRACE_DEFINE_ENUM(FATTR4_WORD1_##x);
+#define fattr4_word1_bit_end(x)		TRACE_DEFINE_ENUM(FATTR4_WORD1_##x);
+
+FATTR4_WORD1_FLAGS
+
+#undef fattr4_word1_bit
+#undef fattr4_word1_bit_end
+#define fattr4_word1_bit(x)		{ FATTR4_WORD1_##x, #x },
+#define fattr4_word1_bit_end(x)		{ FATTR4_WORD1_##x, #x }
+
+#define show_fattr4_bm_word1(x)	__print_flags(x, "|", FATTR4_WORD1_FLAGS)
+
+#define FATTR4_WORD2_FLAGS					\
+	fattr4_word2_bit(LAYOUT_TYPES)				\
+	fattr4_word2_bit(LAYOUT_BLKSIZE)			\
+	fattr4_word2_bit(MDSTHRESHOLD)				\
+	fattr4_word2_bit(SUPPATTR_EXCLCREAT)			\
+	fattr4_word2_bit(CLONE_BLKSIZE)				\
+	fattr4_word2_bit(CHANGE_ATTR_TYPE)			\
+	fattr4_word2_bit(SECURITY_LABEL)			\
+	fattr4_word2_bit(MODE_UMASK)				\
+	fattr4_word2_bit_end(XATTR_SUPPORT)
+
+#undef fattr4_word2_bit
+#undef fattr4_word2_bit_end
+#define fattr4_word2_bit(x)		TRACE_DEFINE_ENUM(FATTR4_WORD2_##x);
+#define fattr4_word2_bit_end(x)		TRACE_DEFINE_ENUM(FATTR4_WORD2_##x);
+
+FATTR4_WORD2_FLAGS
+
+#undef fattr4_word2_bit
+#undef fattr4_word2_bit_end
+#define fattr4_word2_bit(x)		{ FATTR4_WORD2_##x, #x },
+#define fattr4_word2_bit_end(x)		{ FATTR4_WORD2_##x, #x }
+
+#define show_fattr4_bm_word2(x)	__print_flags(x, "|", FATTR4_WORD2_FLAGS)
+
+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_fattr4_bm_word0(__entry->bm0),
+		show_fattr4_bm_word1(__entry->bm1),
+		show_fattr4_bm_word2(__entry->bm2)
+	)
+);
+
 TRACE_EVENT(nfsd_setattr_args,
 	TP_PROTO(
 		const struct svc_rqst *rqstp,





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux