Commit e07db907 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: List stateid information in the callback tracepoints

The stateid is extremely valuable when debugging.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent e0d92430
...@@ -83,8 +83,11 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, ...@@ -83,8 +83,11 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy,
res = htonl(NFS4ERR_BADHANDLE); res = htonl(NFS4ERR_BADHANDLE);
inode = nfs_delegation_find_inode(cps->clp, &args->fh); inode = nfs_delegation_find_inode(cps->clp, &args->fh);
if (inode == NULL) if (inode == NULL) {
trace_nfs4_cb_recall(cps->clp, &args->fh, NULL,
&args->stateid, -ntohl(res));
goto out; goto out;
}
/* Set up a helper thread to actually return the delegation */ /* Set up a helper thread to actually return the delegation */
switch (nfs_async_inode_return_delegation(inode, &args->stateid)) { switch (nfs_async_inode_return_delegation(inode, &args->stateid)) {
case 0: case 0:
...@@ -96,7 +99,8 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, ...@@ -96,7 +99,8 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy,
default: default:
res = htonl(NFS4ERR_RESOURCE); res = htonl(NFS4ERR_RESOURCE);
} }
trace_nfs4_recall_delegation(inode, -ntohl(res)); trace_nfs4_cb_recall(cps->clp, &args->fh, inode,
&args->stateid, -ntohl(res));
iput(inode); iput(inode);
out: out:
dprintk("%s: exit with status = %d\n", __func__, ntohl(res)); dprintk("%s: exit with status = %d\n", __func__, ntohl(res));
...@@ -185,8 +189,11 @@ static u32 initiate_file_draining(struct nfs_client *clp, ...@@ -185,8 +189,11 @@ static u32 initiate_file_draining(struct nfs_client *clp,
LIST_HEAD(free_me_list); LIST_HEAD(free_me_list);
lo = get_layout_by_fh(clp, &args->cbl_fh, &args->cbl_stateid); lo = get_layout_by_fh(clp, &args->cbl_fh, &args->cbl_stateid);
if (!lo) if (!lo) {
trace_nfs4_cb_layoutrecall_file(clp, &args->cbl_fh, NULL,
&args->cbl_stateid, -rv);
goto out; goto out;
}
ino = lo->plh_inode; ino = lo->plh_inode;
...@@ -227,7 +234,8 @@ static u32 initiate_file_draining(struct nfs_client *clp, ...@@ -227,7 +234,8 @@ static u32 initiate_file_draining(struct nfs_client *clp,
spin_unlock(&ino->i_lock); spin_unlock(&ino->i_lock);
pnfs_free_lseg_list(&free_me_list); pnfs_free_lseg_list(&free_me_list);
pnfs_put_layout_hdr(lo); pnfs_put_layout_hdr(lo);
trace_nfs4_cb_layoutrecall_inode(clp, &args->cbl_fh, ino, -rv); trace_nfs4_cb_layoutrecall_file(clp, &args->cbl_fh, ino,
&args->cbl_stateid, -rv);
iput(ino); iput(ino);
out: out:
return rv; return rv;
......
...@@ -982,7 +982,6 @@ DEFINE_NFS4_INODE_EVENT(nfs4_set_acl); ...@@ -982,7 +982,6 @@ DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label); DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label); DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
#endif /* CONFIG_NFS_V4_SECURITY_LABEL */ #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation);
DECLARE_EVENT_CLASS(nfs4_inode_stateid_event, DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
TP_PROTO( TP_PROTO(
...@@ -1145,8 +1144,74 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event, ...@@ -1145,8 +1144,74 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
), \ ), \
TP_ARGS(clp, fhandle, inode, error)) TP_ARGS(clp, fhandle, inode, error))
DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr); DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_layoutrecall_inode);
DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
TP_PROTO(
const struct nfs_client *clp,
const struct nfs_fh *fhandle,
const struct inode *inode,
const nfs4_stateid *stateid,
int error
),
TP_ARGS(clp, fhandle, inode, stateid, error),
TP_STRUCT__entry(
__field(int, error)
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__string(dstaddr, clp ?
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR) : "unknown")
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
__entry->error = error;
__entry->fhandle = nfs_fhandle_hash(fhandle);
if (inode != NULL) {
__entry->fileid = NFS_FILEID(inode);
__entry->dev = inode->i_sb->s_dev;
} else {
__entry->fileid = 0;
__entry->dev = 0;
}
__assign_str(dstaddr, clp ?
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR) : "unknown")
__entry->stateid_seq =
be32_to_cpu(stateid->seqid);
__entry->stateid_hash =
nfs_stateid_hash(stateid);
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"stateid=%d:0x%08x dstaddr=%s",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash,
__get_str(dstaddr)
)
);
#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
TP_PROTO( \
const struct nfs_client *clp, \
const struct nfs_fh *fhandle, \
const struct inode *inode, \
const nfs4_stateid *stateid, \
int error \
), \
TP_ARGS(clp, fhandle, inode, stateid, error))
DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
DECLARE_EVENT_CLASS(nfs4_idmap_event, DECLARE_EVENT_CLASS(nfs4_idmap_event,
TP_PROTO( TP_PROTO(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment