diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-12-28 14:07:23 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-12-28 14:33:05 -0500 |
commit | e07db907eb80525874b7707c62cc6f5e975ef130 (patch) | |
tree | 3b30058c0781e867626f740a2e5b504cf1bce28d /fs/nfs | |
parent | e0d9243048fd18da695b8d3fe331176eac60866e (diff) |
NFSv4: List stateid information in the callback tracepoints
The stateid is extremely valuable when debugging.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/callback_proc.c | 16 | ||||
-rw-r--r-- | fs/nfs/nfs4trace.h | 69 |
2 files changed, 79 insertions, 6 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 724a9b756ab0..e4dbab5dce6e 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -83,8 +83,11 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, | |||
83 | 83 | ||
84 | res = htonl(NFS4ERR_BADHANDLE); | 84 | res = htonl(NFS4ERR_BADHANDLE); |
85 | inode = nfs_delegation_find_inode(cps->clp, &args->fh); | 85 | inode = nfs_delegation_find_inode(cps->clp, &args->fh); |
86 | if (inode == NULL) | 86 | if (inode == NULL) { |
87 | trace_nfs4_cb_recall(cps->clp, &args->fh, NULL, | ||
88 | &args->stateid, -ntohl(res)); | ||
87 | goto out; | 89 | goto out; |
90 | } | ||
88 | /* Set up a helper thread to actually return the delegation */ | 91 | /* Set up a helper thread to actually return the delegation */ |
89 | switch (nfs_async_inode_return_delegation(inode, &args->stateid)) { | 92 | switch (nfs_async_inode_return_delegation(inode, &args->stateid)) { |
90 | case 0: | 93 | case 0: |
@@ -96,7 +99,8 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, | |||
96 | default: | 99 | default: |
97 | res = htonl(NFS4ERR_RESOURCE); | 100 | res = htonl(NFS4ERR_RESOURCE); |
98 | } | 101 | } |
99 | trace_nfs4_recall_delegation(inode, -ntohl(res)); | 102 | trace_nfs4_cb_recall(cps->clp, &args->fh, inode, |
103 | &args->stateid, -ntohl(res)); | ||
100 | iput(inode); | 104 | iput(inode); |
101 | out: | 105 | out: |
102 | dprintk("%s: exit with status = %d\n", __func__, ntohl(res)); | 106 | dprintk("%s: exit with status = %d\n", __func__, ntohl(res)); |
@@ -185,8 +189,11 @@ static u32 initiate_file_draining(struct nfs_client *clp, | |||
185 | LIST_HEAD(free_me_list); | 189 | LIST_HEAD(free_me_list); |
186 | 190 | ||
187 | lo = get_layout_by_fh(clp, &args->cbl_fh, &args->cbl_stateid); | 191 | lo = get_layout_by_fh(clp, &args->cbl_fh, &args->cbl_stateid); |
188 | if (!lo) | 192 | if (!lo) { |
193 | trace_nfs4_cb_layoutrecall_file(clp, &args->cbl_fh, NULL, | ||
194 | &args->cbl_stateid, -rv); | ||
189 | goto out; | 195 | goto out; |
196 | } | ||
190 | 197 | ||
191 | ino = lo->plh_inode; | 198 | ino = lo->plh_inode; |
192 | 199 | ||
@@ -227,7 +234,8 @@ unlock: | |||
227 | spin_unlock(&ino->i_lock); | 234 | spin_unlock(&ino->i_lock); |
228 | pnfs_free_lseg_list(&free_me_list); | 235 | pnfs_free_lseg_list(&free_me_list); |
229 | pnfs_put_layout_hdr(lo); | 236 | pnfs_put_layout_hdr(lo); |
230 | trace_nfs4_cb_layoutrecall_inode(clp, &args->cbl_fh, ino, -rv); | 237 | trace_nfs4_cb_layoutrecall_file(clp, &args->cbl_fh, ino, |
238 | &args->cbl_stateid, -rv); | ||
231 | iput(ino); | 239 | iput(ino); |
232 | out: | 240 | out: |
233 | return rv; | 241 | return rv; |
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index d08d0c84b778..88b6b14ce71b 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h | |||
@@ -982,7 +982,6 @@ DEFINE_NFS4_INODE_EVENT(nfs4_set_acl); | |||
982 | DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label); | 982 | DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label); |
983 | DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label); | 983 | DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label); |
984 | #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ | 984 | #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ |
985 | DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation); | ||
986 | 985 | ||
987 | DECLARE_EVENT_CLASS(nfs4_inode_stateid_event, | 986 | DECLARE_EVENT_CLASS(nfs4_inode_stateid_event, |
988 | TP_PROTO( | 987 | TP_PROTO( |
@@ -1145,8 +1144,74 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event, | |||
1145 | ), \ | 1144 | ), \ |
1146 | TP_ARGS(clp, fhandle, inode, error)) | 1145 | TP_ARGS(clp, fhandle, inode, error)) |
1147 | DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr); | 1146 | DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr); |
1148 | DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_layoutrecall_inode); | ||
1149 | 1147 | ||
1148 | DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event, | ||
1149 | TP_PROTO( | ||
1150 | const struct nfs_client *clp, | ||
1151 | const struct nfs_fh *fhandle, | ||
1152 | const struct inode *inode, | ||
1153 | const nfs4_stateid *stateid, | ||
1154 | int error | ||
1155 | ), | ||
1156 | |||
1157 | TP_ARGS(clp, fhandle, inode, stateid, error), | ||
1158 | |||
1159 | TP_STRUCT__entry( | ||
1160 | __field(int, error) | ||
1161 | __field(dev_t, dev) | ||
1162 | __field(u32, fhandle) | ||
1163 | __field(u64, fileid) | ||
1164 | __string(dstaddr, clp ? | ||
1165 | rpc_peeraddr2str(clp->cl_rpcclient, | ||
1166 | RPC_DISPLAY_ADDR) : "unknown") | ||
1167 | __field(int, stateid_seq) | ||
1168 | __field(u32, stateid_hash) | ||
1169 | ), | ||
1170 | |||
1171 | TP_fast_assign( | ||
1172 | __entry->error = error; | ||
1173 | __entry->fhandle = nfs_fhandle_hash(fhandle); | ||
1174 | if (inode != NULL) { | ||
1175 | __entry->fileid = NFS_FILEID(inode); | ||
1176 | __entry->dev = inode->i_sb->s_dev; | ||
1177 | } else { | ||
1178 | __entry->fileid = 0; | ||
1179 | __entry->dev = 0; | ||
1180 | } | ||
1181 | __assign_str(dstaddr, clp ? | ||
1182 | rpc_peeraddr2str(clp->cl_rpcclient, | ||
1183 | RPC_DISPLAY_ADDR) : "unknown") | ||
1184 | __entry->stateid_seq = | ||
1185 | be32_to_cpu(stateid->seqid); | ||
1186 | __entry->stateid_hash = | ||
1187 | nfs_stateid_hash(stateid); | ||
1188 | ), | ||
1189 | |||
1190 | TP_printk( | ||
1191 | "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " | ||
1192 | "stateid=%d:0x%08x dstaddr=%s", | ||
1193 | __entry->error, | ||
1194 | show_nfsv4_errors(__entry->error), | ||
1195 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
1196 | (unsigned long long)__entry->fileid, | ||
1197 | __entry->fhandle, | ||
1198 | __entry->stateid_seq, __entry->stateid_hash, | ||
1199 | __get_str(dstaddr) | ||
1200 | ) | ||
1201 | ); | ||
1202 | |||
1203 | #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \ | ||
1204 | DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \ | ||
1205 | TP_PROTO( \ | ||
1206 | const struct nfs_client *clp, \ | ||
1207 | const struct nfs_fh *fhandle, \ | ||
1208 | const struct inode *inode, \ | ||
1209 | const nfs4_stateid *stateid, \ | ||
1210 | int error \ | ||
1211 | ), \ | ||
1212 | TP_ARGS(clp, fhandle, inode, stateid, error)) | ||
1213 | DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall); | ||
1214 | DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file); | ||
1150 | 1215 | ||
1151 | DECLARE_EVENT_CLASS(nfs4_idmap_event, | 1216 | DECLARE_EVENT_CLASS(nfs4_idmap_event, |
1152 | TP_PROTO( | 1217 | TP_PROTO( |