Skip to content

Commit 43622ea

Browse files
author
Trond Myklebust
committed
NFS: Add a tracepoint in nfs_fh_to_dentry()
Add a tracepoint in nfs_fh_to_dentry() for debugging issues with bad userspace filehandles. Signed-off-by: Trond Myklebust <[email protected]>
1 parent 70d136b commit 43622ea

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

fs/nfs/export.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
105105
ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, label, NULL);
106106
if (ret) {
107107
dprintk("%s: getattr failed %d\n", __func__, ret);
108+
trace_nfs_fh_to_dentry(sb, server_fh, fattr->fileid, ret);
108109
dentry = ERR_PTR(ret);
109110
goto out_free_label;
110111
}

fs/nfs/nfstrace.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,39 @@ TRACE_EVENT(nfs_commit_done,
10651065
)
10661066
);
10671067

1068+
TRACE_EVENT(nfs_fh_to_dentry,
1069+
TP_PROTO(
1070+
const struct super_block *sb,
1071+
const struct nfs_fh *fh,
1072+
u64 fileid,
1073+
int error
1074+
),
1075+
1076+
TP_ARGS(sb, fh, fileid, error),
1077+
1078+
TP_STRUCT__entry(
1079+
__field(int, error)
1080+
__field(dev_t, dev)
1081+
__field(u32, fhandle)
1082+
__field(u64, fileid)
1083+
),
1084+
1085+
TP_fast_assign(
1086+
__entry->error = error;
1087+
__entry->dev = sb->s_dev;
1088+
__entry->fileid = fileid;
1089+
__entry->fhandle = nfs_fhandle_hash(fh);
1090+
),
1091+
1092+
TP_printk(
1093+
"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ",
1094+
__entry->error,
1095+
MAJOR(__entry->dev), MINOR(__entry->dev),
1096+
(unsigned long long)__entry->fileid,
1097+
__entry->fhandle
1098+
)
1099+
);
1100+
10681101
TRACE_DEFINE_ENUM(NFS_OK);
10691102
TRACE_DEFINE_ENUM(NFSERR_PERM);
10701103
TRACE_DEFINE_ENUM(NFSERR_NOENT);

0 commit comments

Comments
 (0)