NFSv4: Add tracepoints for debugging getattr
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 13 Aug 2013 17:01:39 +0000 (13:01 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 22 Aug 2013 12:58:25 +0000 (08:58 -0400)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4proc.c
fs/nfs/nfs4trace.h

index cbbaee27bf8230908700da6dd185daf7035f24b6..bcfe3adb20570f6b1539404568288eb9c47e492f 100644 (file)
@@ -2697,6 +2697,7 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
        int err;
        do {
                err = _nfs4_lookup_root(server, fhandle, info);
+               trace_nfs4_lookup_root(server, fhandle, info->fattr, err);
                switch (err) {
                case 0:
                case -NFS4ERR_WRONGSEC:
@@ -2906,8 +2907,9 @@ static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
        struct nfs4_exception exception = { };
        int err;
        do {
-               err = nfs4_handle_exception(server,
-                               _nfs4_proc_getattr(server, fhandle, fattr, label),
+               err = _nfs4_proc_getattr(server, fhandle, fattr, label);
+               trace_nfs4_getattr(server, fhandle, fattr, err);
+               err = nfs4_handle_exception(server, err,
                                &exception);
        } while (exception.retry);
        return err;
@@ -3760,6 +3762,7 @@ static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, str
 
        do {
                err = _nfs4_do_fsinfo(server, fhandle, fsinfo);
+               trace_nfs4_fsinfo(server, fhandle, fsinfo->fattr, err);
                if (err == 0) {
                        struct nfs_client *clp = server->nfs_client;
 
index f58edcf418bf0a8dbf23710ca0e8a1cfd7dcfa1e..99d1b1e796508227487e0631162f6ed7b0b13784 100644 (file)
                { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
                { ((__force unsigned long)FMODE_EXEC), "EXEC" })
 
+#define show_nfs_fattr_flags(valid) \
+       __print_flags((unsigned long)valid, "|", \
+               { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
+               { NFS_ATTR_FATTR_MODE, "MODE" }, \
+               { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
+               { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
+               { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
+               { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
+               { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
+               { NFS_ATTR_FATTR_FSID, "FSID" }, \
+               { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
+               { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
+               { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
+               { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
+               { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
+               { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
+               { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
+
 DECLARE_EVENT_CLASS(nfs4_clientid_event,
                TP_PROTO(
                        const struct nfs_client *clp,
@@ -627,6 +645,57 @@ DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
 DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation);
 DEFINE_NFS4_INODE_EVENT(nfs4_delegreturn);
 
+DECLARE_EVENT_CLASS(nfs4_getattr_event,
+               TP_PROTO(
+                       const struct nfs_server *server,
+                       const struct nfs_fh *fhandle,
+                       const struct nfs_fattr *fattr,
+                       int error
+               ),
+
+               TP_ARGS(server, fhandle, fattr, error),
+
+               TP_STRUCT__entry(
+                       __field(dev_t, dev)
+                       __field(u32, fhandle)
+                       __field(u64, fileid)
+                       __field(unsigned int, valid)
+                       __field(int, error)
+               ),
+
+               TP_fast_assign(
+                       __entry->dev = server->s_dev;
+                       __entry->valid = fattr->valid;
+                       __entry->fhandle = nfs_fhandle_hash(fhandle);
+                       __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
+                       __entry->error = error;
+               ),
+
+               TP_printk(
+                       "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
+                       "valid=%s",
+                       __entry->error,
+                       show_nfsv4_errors(__entry->error),
+                       MAJOR(__entry->dev), MINOR(__entry->dev),
+                       (unsigned long long)__entry->fileid,
+                       __entry->fhandle,
+                       show_nfs_fattr_flags(__entry->valid)
+               )
+);
+
+#define DEFINE_NFS4_GETATTR_EVENT(name) \
+       DEFINE_EVENT(nfs4_getattr_event, name, \
+                       TP_PROTO( \
+                               const struct nfs_server *server, \
+                               const struct nfs_fh *fhandle, \
+                               const struct nfs_fattr *fattr, \
+                               int error \
+                       ), \
+                       TP_ARGS(server, fhandle, fattr, error))
+DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
+DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
+DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
+
 DECLARE_EVENT_CLASS(nfs4_idmap_event,
                TP_PROTO(
                        const char *name,