2 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
5 #define TRACE_SYSTEM nfs4
7 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
10 #include <linux/tracepoint.h>
12 #define show_nfsv4_errors(error) \
13 __print_symbolic(error, \
15 /* Mapped by nfs4_stat_to_errno() */ \
16 { -EPERM, "EPERM" }, \
17 { -ENOENT, "ENOENT" }, \
19 { -ENXIO, "ENXIO" }, \
20 { -EACCES, "EACCES" }, \
21 { -EEXIST, "EEXIST" }, \
22 { -EXDEV, "EXDEV" }, \
23 { -ENOTDIR, "ENOTDIR" }, \
24 { -EISDIR, "EISDIR" }, \
25 { -EFBIG, "EFBIG" }, \
26 { -ENOSPC, "ENOSPC" }, \
27 { -EROFS, "EROFS" }, \
28 { -EMLINK, "EMLINK" }, \
29 { -ENAMETOOLONG, "ENAMETOOLONG" }, \
30 { -ENOTEMPTY, "ENOTEMPTY" }, \
31 { -EDQUOT, "EDQUOT" }, \
32 { -ESTALE, "ESTALE" }, \
33 { -EBADHANDLE, "EBADHANDLE" }, \
34 { -EBADCOOKIE, "EBADCOOKIE" }, \
35 { -ENOTSUPP, "ENOTSUPP" }, \
36 { -ETOOSMALL, "ETOOSMALL" }, \
37 { -EREMOTEIO, "EREMOTEIO" }, \
38 { -EBADTYPE, "EBADTYPE" }, \
39 { -EAGAIN, "EAGAIN" }, \
40 { -ELOOP, "ELOOP" }, \
41 { -EOPNOTSUPP, "EOPNOTSUPP" }, \
42 { -EDEADLK, "EDEADLK" }, \
44 { -ENOMEM, "ENOMEM" }, \
45 { -EKEYEXPIRED, "EKEYEXPIRED" }, \
46 { -ETIMEDOUT, "ETIMEDOUT" }, \
47 { -ERESTARTSYS, "ERESTARTSYS" }, \
48 { -ECONNREFUSED, "ECONNREFUSED" }, \
49 { -ECONNRESET, "ECONNRESET" }, \
50 { -ENETUNREACH, "ENETUNREACH" }, \
51 { -EHOSTUNREACH, "EHOSTUNREACH" }, \
52 { -EHOSTDOWN, "EHOSTDOWN" }, \
53 { -EPIPE, "EPIPE" }, \
54 { -EPFNOSUPPORT, "EPFNOSUPPORT" }, \
55 { -EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
56 /* NFSv4 native errors */ \
57 { -NFS4ERR_ACCESS, "ACCESS" }, \
58 { -NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
59 { -NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
60 { -NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
61 { -NFS4ERR_BADCHAR, "BADCHAR" }, \
62 { -NFS4ERR_BADHANDLE, "BADHANDLE" }, \
63 { -NFS4ERR_BADIOMODE, "BADIOMODE" }, \
64 { -NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
65 { -NFS4ERR_BADLABEL, "BADLABEL" }, \
66 { -NFS4ERR_BADNAME, "BADNAME" }, \
67 { -NFS4ERR_BADOWNER, "BADOWNER" }, \
68 { -NFS4ERR_BADSESSION, "BADSESSION" }, \
69 { -NFS4ERR_BADSLOT, "BADSLOT" }, \
70 { -NFS4ERR_BADTYPE, "BADTYPE" }, \
71 { -NFS4ERR_BADXDR, "BADXDR" }, \
72 { -NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
73 { -NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
74 { -NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
75 { -NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
76 { -NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
77 { -NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
78 { -NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
79 { -NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
80 { -NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
81 { -NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
82 { -NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
83 "CONN_NOT_BOUND_TO_SESSION" }, \
84 { -NFS4ERR_DEADLOCK, "DEADLOCK" }, \
85 { -NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
86 { -NFS4ERR_DELAY, "DELAY" }, \
87 { -NFS4ERR_DELEG_ALREADY_WANTED, \
88 "DELEG_ALREADY_WANTED" }, \
89 { -NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
90 { -NFS4ERR_DENIED, "DENIED" }, \
91 { -NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
92 { -NFS4ERR_DQUOT, "DQUOT" }, \
93 { -NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
94 { -NFS4ERR_EXIST, "EXIST" }, \
95 { -NFS4ERR_EXPIRED, "EXPIRED" }, \
96 { -NFS4ERR_FBIG, "FBIG" }, \
97 { -NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
98 { -NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
99 { -NFS4ERR_GRACE, "GRACE" }, \
100 { -NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
101 { -NFS4ERR_INVAL, "INVAL" }, \
102 { -NFS4ERR_IO, "IO" }, \
103 { -NFS4ERR_ISDIR, "ISDIR" }, \
104 { -NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
105 { -NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
106 { -NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
107 { -NFS4ERR_LOCKED, "LOCKED" }, \
108 { -NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
109 { -NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
110 { -NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
111 { -NFS4ERR_MLINK, "MLINK" }, \
112 { -NFS4ERR_MOVED, "MOVED" }, \
113 { -NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
114 { -NFS4ERR_NOENT, "NOENT" }, \
115 { -NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
116 { -NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
117 { -NFS4ERR_NOSPC, "NOSPC" }, \
118 { -NFS4ERR_NOTDIR, "NOTDIR" }, \
119 { -NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
120 { -NFS4ERR_NOTSUPP, "NOTSUPP" }, \
121 { -NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
122 { -NFS4ERR_NOT_SAME, "NOT_SAME" }, \
123 { -NFS4ERR_NO_GRACE, "NO_GRACE" }, \
124 { -NFS4ERR_NXIO, "NXIO" }, \
125 { -NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
126 { -NFS4ERR_OPENMODE, "OPENMODE" }, \
127 { -NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
128 { -NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
129 { -NFS4ERR_PERM, "PERM" }, \
130 { -NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
131 { -NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
132 { -NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
133 { -NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
134 { -NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
135 { -NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
136 { -NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
137 { -NFS4ERR_REP_TOO_BIG_TO_CACHE, \
138 "REP_TOO_BIG_TO_CACHE" }, \
139 { -NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
140 { -NFS4ERR_RESOURCE, "RESOURCE" }, \
141 { -NFS4ERR_RESTOREFH, "RESTOREFH" }, \
142 { -NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
143 { -NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
144 { -NFS4ERR_ROFS, "ROFS" }, \
145 { -NFS4ERR_SAME, "SAME" }, \
146 { -NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
147 { -NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
148 { -NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
149 { -NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
150 { -NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
151 { -NFS4ERR_STALE, "STALE" }, \
152 { -NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
153 { -NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
154 { -NFS4ERR_SYMLINK, "SYMLINK" }, \
155 { -NFS4ERR_TOOSMALL, "TOOSMALL" }, \
156 { -NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
157 { -NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
158 { -NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
159 { -NFS4ERR_WRONGSEC, "WRONGSEC" }, \
160 { -NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
161 { -NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
162 { -NFS4ERR_XDEV, "XDEV" })
164 #define show_open_flags(flags) \
165 __print_flags(flags, "|", \
166 { O_CREAT, "O_CREAT" }, \
167 { O_EXCL, "O_EXCL" }, \
168 { O_TRUNC, "O_TRUNC" }, \
169 { O_DIRECT, "O_DIRECT" })
171 #define show_fmode_flags(mode) \
172 __print_flags(mode, "|", \
173 { ((__force unsigned long)FMODE_READ), "READ" }, \
174 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
175 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
177 DECLARE_EVENT_CLASS(nfs4_clientid_event
,
179 const struct nfs_client
*clp
,
187 rpc_peeraddr2str(clp
->cl_rpcclient
,
193 __entry
->error
= error
;
194 __assign_str(dstaddr
,
195 rpc_peeraddr2str(clp
->cl_rpcclient
,
200 "error=%d (%s) dstaddr=%s",
202 show_nfsv4_errors(__entry
->error
),
206 #define DEFINE_NFS4_CLIENTID_EVENT(name) \
207 DEFINE_EVENT(nfs4_clientid_event, name, \
209 const struct nfs_client *clp, \
213 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid
);
214 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm
);
215 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew
);
216 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async
);
217 #ifdef CONFIG_NFS_V4_1
218 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id
);
219 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session
);
220 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session
);
221 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid
);
222 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session
);
223 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence
);
224 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete
);
225 #endif /* CONFIG_NFS_V4_1 */
227 DECLARE_EVENT_CLASS(nfs4_open_event
,
229 const struct nfs_open_context
*ctx
,
234 TP_ARGS(ctx
, flags
, error
),
238 __field(unsigned int, flags
)
239 __field(unsigned int, fmode
)
241 __field(u32
, fhandle
)
244 __string(name
, ctx
->dentry
->d_name
.name
)
248 const struct nfs4_state
*state
= ctx
->state
;
249 const struct inode
*inode
= NULL
;
251 __entry
->error
= error
;
252 __entry
->flags
= flags
;
253 __entry
->fmode
= (__force
unsigned int)ctx
->mode
;
254 __entry
->dev
= ctx
->dentry
->d_sb
->s_dev
;
256 inode
= state
->inode
;
258 __entry
->fileid
= NFS_FILEID(inode
);
259 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
262 __entry
->fhandle
= 0;
264 __entry
->dir
= NFS_FILEID(ctx
->dentry
->d_parent
->d_inode
);
265 __assign_str(name
, ctx
->dentry
->d_name
.name
);
269 "error=%d (%s) flags=%d (%s) fmode=%s "
270 "fileid=%02x:%02x:%llu fhandle=0x%08x "
271 "name=%02x:%02x:%llu/%s",
273 show_nfsv4_errors(__entry
->error
),
275 show_open_flags(__entry
->flags
),
276 show_fmode_flags(__entry
->fmode
),
277 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
278 (unsigned long long)__entry
->fileid
,
280 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
281 (unsigned long long)__entry
->dir
,
286 #define DEFINE_NFS4_OPEN_EVENT(name) \
287 DEFINE_EVENT(nfs4_open_event, name, \
289 const struct nfs_open_context *ctx, \
293 TP_ARGS(ctx, flags, error))
294 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim
);
295 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired
);
296 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file
);
298 TRACE_EVENT(nfs4_close
,
300 const struct nfs4_state
*state
,
301 const struct nfs_closeargs
*args
,
302 const struct nfs_closeres
*res
,
306 TP_ARGS(state
, args
, res
, error
),
310 __field(u32
, fhandle
)
312 __field(unsigned int, fmode
)
317 const struct inode
*inode
= state
->inode
;
319 __entry
->dev
= inode
->i_sb
->s_dev
;
320 __entry
->fileid
= NFS_FILEID(inode
);
321 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
322 __entry
->fmode
= (__force
unsigned int)state
->state
;
323 __entry
->error
= error
;
327 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
330 show_nfsv4_errors(__entry
->error
),
331 __entry
->fmode
? show_fmode_flags(__entry
->fmode
) :
333 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
334 (unsigned long long)__entry
->fileid
,
339 #define show_lock_cmd(type) \
340 __print_symbolic((int)type, \
341 { F_GETLK, "GETLK" }, \
342 { F_SETLK, "SETLK" }, \
343 { F_SETLKW, "SETLKW" })
344 #define show_lock_type(type) \
345 __print_symbolic((int)type, \
346 { F_RDLCK, "RDLCK" }, \
347 { F_WRLCK, "WRLCK" }, \
348 { F_UNLCK, "UNLCK" })
350 DECLARE_EVENT_CLASS(nfs4_lock_event
,
352 const struct file_lock
*request
,
353 const struct nfs4_state
*state
,
358 TP_ARGS(request
, state
, cmd
, error
),
364 __field(loff_t
, start
)
367 __field(u32
, fhandle
)
372 const struct inode
*inode
= state
->inode
;
374 __entry
->error
= error
;
376 __entry
->type
= request
->fl_type
;
377 __entry
->start
= request
->fl_start
;
378 __entry
->end
= request
->fl_end
;
379 __entry
->dev
= inode
->i_sb
->s_dev
;
380 __entry
->fileid
= NFS_FILEID(inode
);
381 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
385 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
386 "fileid=%02x:%02x:%llu fhandle=0x%08x",
388 show_nfsv4_errors(__entry
->error
),
389 show_lock_cmd(__entry
->cmd
),
390 show_lock_type(__entry
->type
),
391 (long long)__entry
->start
,
392 (long long)__entry
->end
,
393 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
394 (unsigned long long)__entry
->fileid
,
399 #define DEFINE_NFS4_LOCK_EVENT(name) \
400 DEFINE_EVENT(nfs4_lock_event, name, \
402 const struct file_lock *request, \
403 const struct nfs4_state *state, \
407 TP_ARGS(request, state, cmd, error))
408 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock
);
409 DEFINE_NFS4_LOCK_EVENT(nfs4_set_lock
);
410 DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim
);
411 DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired
);
412 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock
);
414 DECLARE_EVENT_CLASS(nfs4_lookup_event
,
416 const struct inode
*dir
,
417 const struct qstr
*name
,
421 TP_ARGS(dir
, name
, error
),
427 __string(name
, name
->name
)
431 __entry
->dev
= dir
->i_sb
->s_dev
;
432 __entry
->dir
= NFS_FILEID(dir
);
433 __entry
->error
= error
;
434 __assign_str(name
, name
->name
);
438 "error=%d (%s) name=%02x:%02x:%llu/%s",
440 show_nfsv4_errors(__entry
->error
),
441 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
442 (unsigned long long)__entry
->dir
,
447 #define DEFINE_NFS4_LOOKUP_EVENT(name) \
448 DEFINE_EVENT(nfs4_lookup_event, name, \
450 const struct inode *dir, \
451 const struct qstr *name, \
454 TP_ARGS(dir, name, error))
456 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup
);
457 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink
);
458 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir
);
459 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod
);
460 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove
);
461 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations
);
462 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo
);
464 #endif /* _TRACE_NFS4_H */
466 #undef TRACE_INCLUDE_PATH
467 #define TRACE_INCLUDE_PATH .
468 #define TRACE_INCLUDE_FILE nfs4trace
469 /* This part must be outside protection */
470 #include <trace/define_trace.h>