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 #define show_nfs_fattr_flags(valid) \
178 __print_flags((unsigned long)valid, "|", \
179 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
180 { NFS_ATTR_FATTR_MODE, "MODE" }, \
181 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
182 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
183 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
184 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
185 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
186 { NFS_ATTR_FATTR_FSID, "FSID" }, \
187 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
188 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
189 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
190 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
191 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
192 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
193 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
195 DECLARE_EVENT_CLASS(nfs4_clientid_event
,
197 const struct nfs_client
*clp
,
205 rpc_peeraddr2str(clp
->cl_rpcclient
,
211 __entry
->error
= error
;
212 __assign_str(dstaddr
,
213 rpc_peeraddr2str(clp
->cl_rpcclient
,
218 "error=%d (%s) dstaddr=%s",
220 show_nfsv4_errors(__entry
->error
),
224 #define DEFINE_NFS4_CLIENTID_EVENT(name) \
225 DEFINE_EVENT(nfs4_clientid_event, name, \
227 const struct nfs_client *clp, \
231 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid
);
232 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm
);
233 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew
);
234 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async
);
235 #ifdef CONFIG_NFS_V4_1
236 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id
);
237 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session
);
238 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session
);
239 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid
);
240 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session
);
241 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence
);
242 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete
);
244 TRACE_EVENT(nfs4_setup_sequence
,
246 const struct nfs4_session
*session
,
247 const struct nfs4_sequence_args
*args
249 TP_ARGS(session
, args
),
252 __field(unsigned int, session
)
253 __field(unsigned int, slot_nr
)
254 __field(unsigned int, seq_nr
)
255 __field(unsigned int, highest_used_slotid
)
259 const struct nfs4_slot
*sa_slot
= args
->sa_slot
;
260 __entry
->session
= nfs_session_id_hash(&session
->sess_id
);
261 __entry
->slot_nr
= sa_slot
->slot_nr
;
262 __entry
->seq_nr
= sa_slot
->seq_nr
;
263 __entry
->highest_used_slotid
=
264 sa_slot
->table
->highest_used_slotid
;
267 "session=0x%08x slot_nr=%u seq_nr=%u "
268 "highest_used_slotid=%u",
272 __entry
->highest_used_slotid
276 #define show_nfs4_sequence_status_flags(status) \
277 __print_flags((unsigned long)status, "|", \
278 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
279 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
280 "CB_GSS_CONTEXTS_EXPIRING" }, \
281 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
282 "CB_GSS_CONTEXTS_EXPIRED" }, \
283 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
284 "EXPIRED_ALL_STATE_REVOKED" }, \
285 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
286 "EXPIRED_SOME_STATE_REVOKED" }, \
287 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
288 "ADMIN_STATE_REVOKED" }, \
289 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
290 "RECALLABLE_STATE_REVOKED" }, \
291 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
292 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
293 "RESTART_RECLAIM_NEEDED" }, \
294 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
295 "CB_PATH_DOWN_SESSION" }, \
296 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
297 "BACKCHANNEL_FAULT" })
299 TRACE_EVENT(nfs4_sequence_done
,
301 const struct nfs4_session
*session
,
302 const struct nfs4_sequence_res
*res
304 TP_ARGS(session
, res
),
307 __field(unsigned int, session
)
308 __field(unsigned int, slot_nr
)
309 __field(unsigned int, seq_nr
)
310 __field(unsigned int, highest_slotid
)
311 __field(unsigned int, target_highest_slotid
)
312 __field(unsigned int, status_flags
)
317 const struct nfs4_slot
*sr_slot
= res
->sr_slot
;
318 __entry
->session
= nfs_session_id_hash(&session
->sess_id
);
319 __entry
->slot_nr
= sr_slot
->slot_nr
;
320 __entry
->seq_nr
= sr_slot
->seq_nr
;
321 __entry
->highest_slotid
= res
->sr_highest_slotid
;
322 __entry
->target_highest_slotid
=
323 res
->sr_target_highest_slotid
;
324 __entry
->error
= res
->sr_status
;
327 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
328 "highest_slotid=%u target_highest_slotid=%u "
329 "status_flags=%u (%s)",
331 show_nfsv4_errors(__entry
->error
),
335 __entry
->highest_slotid
,
336 __entry
->target_highest_slotid
,
337 __entry
->status_flags
,
338 show_nfs4_sequence_status_flags(__entry
->status_flags
)
342 struct cb_sequenceargs
;
343 struct cb_sequenceres
;
345 TRACE_EVENT(nfs4_cb_sequence
,
347 const struct cb_sequenceargs
*args
,
348 const struct cb_sequenceres
*res
,
351 TP_ARGS(args
, res
, status
),
354 __field(unsigned int, session
)
355 __field(unsigned int, slot_nr
)
356 __field(unsigned int, seq_nr
)
357 __field(unsigned int, highest_slotid
)
358 __field(unsigned int, cachethis
)
363 __entry
->session
= nfs_session_id_hash(&args
->csa_sessionid
);
364 __entry
->slot_nr
= args
->csa_slotid
;
365 __entry
->seq_nr
= args
->csa_sequenceid
;
366 __entry
->highest_slotid
= args
->csa_highestslotid
;
367 __entry
->cachethis
= args
->csa_cachethis
;
368 __entry
->error
= -be32_to_cpu(status
);
372 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
375 show_nfsv4_errors(__entry
->error
),
379 __entry
->highest_slotid
382 #endif /* CONFIG_NFS_V4_1 */
384 DECLARE_EVENT_CLASS(nfs4_open_event
,
386 const struct nfs_open_context
*ctx
,
391 TP_ARGS(ctx
, flags
, error
),
395 __field(unsigned int, flags
)
396 __field(unsigned int, fmode
)
398 __field(u32
, fhandle
)
401 __string(name
, ctx
->dentry
->d_name
.name
)
405 const struct nfs4_state
*state
= ctx
->state
;
406 const struct inode
*inode
= NULL
;
408 __entry
->error
= error
;
409 __entry
->flags
= flags
;
410 __entry
->fmode
= (__force
unsigned int)ctx
->mode
;
411 __entry
->dev
= ctx
->dentry
->d_sb
->s_dev
;
413 inode
= state
->inode
;
415 __entry
->fileid
= NFS_FILEID(inode
);
416 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
419 __entry
->fhandle
= 0;
421 __entry
->dir
= NFS_FILEID(d_inode(ctx
->dentry
->d_parent
));
422 __assign_str(name
, ctx
->dentry
->d_name
.name
);
426 "error=%d (%s) flags=%d (%s) fmode=%s "
427 "fileid=%02x:%02x:%llu fhandle=0x%08x "
428 "name=%02x:%02x:%llu/%s",
430 show_nfsv4_errors(__entry
->error
),
432 show_open_flags(__entry
->flags
),
433 show_fmode_flags(__entry
->fmode
),
434 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
435 (unsigned long long)__entry
->fileid
,
437 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
438 (unsigned long long)__entry
->dir
,
443 #define DEFINE_NFS4_OPEN_EVENT(name) \
444 DEFINE_EVENT(nfs4_open_event, name, \
446 const struct nfs_open_context *ctx, \
450 TP_ARGS(ctx, flags, error))
451 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim
);
452 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired
);
453 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file
);
455 TRACE_EVENT(nfs4_close
,
457 const struct nfs4_state
*state
,
458 const struct nfs_closeargs
*args
,
459 const struct nfs_closeres
*res
,
463 TP_ARGS(state
, args
, res
, error
),
467 __field(u32
, fhandle
)
469 __field(unsigned int, fmode
)
474 const struct inode
*inode
= state
->inode
;
476 __entry
->dev
= inode
->i_sb
->s_dev
;
477 __entry
->fileid
= NFS_FILEID(inode
);
478 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
479 __entry
->fmode
= (__force
unsigned int)state
->state
;
480 __entry
->error
= error
;
484 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
487 show_nfsv4_errors(__entry
->error
),
488 __entry
->fmode
? show_fmode_flags(__entry
->fmode
) :
490 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
491 (unsigned long long)__entry
->fileid
,
496 #define show_lock_cmd(type) \
497 __print_symbolic((int)type, \
498 { F_GETLK, "GETLK" }, \
499 { F_SETLK, "SETLK" }, \
500 { F_SETLKW, "SETLKW" })
501 #define show_lock_type(type) \
502 __print_symbolic((int)type, \
503 { F_RDLCK, "RDLCK" }, \
504 { F_WRLCK, "WRLCK" }, \
505 { F_UNLCK, "UNLCK" })
507 DECLARE_EVENT_CLASS(nfs4_lock_event
,
509 const struct file_lock
*request
,
510 const struct nfs4_state
*state
,
515 TP_ARGS(request
, state
, cmd
, error
),
521 __field(loff_t
, start
)
524 __field(u32
, fhandle
)
529 const struct inode
*inode
= state
->inode
;
531 __entry
->error
= error
;
533 __entry
->type
= request
->fl_type
;
534 __entry
->start
= request
->fl_start
;
535 __entry
->end
= request
->fl_end
;
536 __entry
->dev
= inode
->i_sb
->s_dev
;
537 __entry
->fileid
= NFS_FILEID(inode
);
538 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
542 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
543 "fileid=%02x:%02x:%llu fhandle=0x%08x",
545 show_nfsv4_errors(__entry
->error
),
546 show_lock_cmd(__entry
->cmd
),
547 show_lock_type(__entry
->type
),
548 (long long)__entry
->start
,
549 (long long)__entry
->end
,
550 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
551 (unsigned long long)__entry
->fileid
,
556 #define DEFINE_NFS4_LOCK_EVENT(name) \
557 DEFINE_EVENT(nfs4_lock_event, name, \
559 const struct file_lock *request, \
560 const struct nfs4_state *state, \
564 TP_ARGS(request, state, cmd, error))
565 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock
);
566 DEFINE_NFS4_LOCK_EVENT(nfs4_set_lock
);
567 DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim
);
568 DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired
);
569 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock
);
571 DECLARE_EVENT_CLASS(nfs4_set_delegation_event
,
573 const struct inode
*inode
,
577 TP_ARGS(inode
, fmode
),
581 __field(u32
, fhandle
)
583 __field(unsigned int, fmode
)
587 __entry
->dev
= inode
->i_sb
->s_dev
;
588 __entry
->fileid
= NFS_FILEID(inode
);
589 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
590 __entry
->fmode
= (__force
unsigned int)fmode
;
594 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
595 show_fmode_flags(__entry
->fmode
),
596 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
597 (unsigned long long)__entry
->fileid
,
601 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
602 DEFINE_EVENT(nfs4_set_delegation_event, name, \
604 const struct inode *inode, \
607 TP_ARGS(inode, fmode))
608 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation
);
609 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation
);
611 TRACE_EVENT(nfs4_delegreturn_exit
,
613 const struct nfs4_delegreturnargs
*args
,
614 const struct nfs4_delegreturnres
*res
,
618 TP_ARGS(args
, res
, error
),
622 __field(u32
, fhandle
)
627 __entry
->dev
= res
->server
->s_dev
;
628 __entry
->fhandle
= nfs_fhandle_hash(args
->fhandle
);
629 __entry
->error
= error
;
633 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x",
635 show_nfsv4_errors(__entry
->error
),
636 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
641 #ifdef CONFIG_NFS_V4_1
642 DECLARE_EVENT_CLASS(nfs4_test_stateid_event
,
644 const struct nfs4_state
*state
,
645 const struct nfs4_lock_state
*lsp
,
649 TP_ARGS(state
, lsp
, error
),
654 __field(u32
, fhandle
)
659 const struct inode
*inode
= state
->inode
;
661 __entry
->error
= error
;
662 __entry
->dev
= inode
->i_sb
->s_dev
;
663 __entry
->fileid
= NFS_FILEID(inode
);
664 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
668 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
670 show_nfsv4_errors(__entry
->error
),
671 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
672 (unsigned long long)__entry
->fileid
,
677 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
678 DEFINE_EVENT(nfs4_test_stateid_event, name, \
680 const struct nfs4_state *state, \
681 const struct nfs4_lock_state *lsp, \
684 TP_ARGS(state, lsp, error))
685 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid
);
686 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid
);
687 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid
);
688 #endif /* CONFIG_NFS_V4_1 */
690 DECLARE_EVENT_CLASS(nfs4_lookup_event
,
692 const struct inode
*dir
,
693 const struct qstr
*name
,
697 TP_ARGS(dir
, name
, error
),
703 __string(name
, name
->name
)
707 __entry
->dev
= dir
->i_sb
->s_dev
;
708 __entry
->dir
= NFS_FILEID(dir
);
709 __entry
->error
= error
;
710 __assign_str(name
, name
->name
);
714 "error=%d (%s) name=%02x:%02x:%llu/%s",
716 show_nfsv4_errors(__entry
->error
),
717 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
718 (unsigned long long)__entry
->dir
,
723 #define DEFINE_NFS4_LOOKUP_EVENT(name) \
724 DEFINE_EVENT(nfs4_lookup_event, name, \
726 const struct inode *dir, \
727 const struct qstr *name, \
730 TP_ARGS(dir, name, error))
732 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup
);
733 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink
);
734 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir
);
735 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod
);
736 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove
);
737 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations
);
738 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo
);
740 TRACE_EVENT(nfs4_rename
,
742 const struct inode
*olddir
,
743 const struct qstr
*oldname
,
744 const struct inode
*newdir
,
745 const struct qstr
*newname
,
749 TP_ARGS(olddir
, oldname
, newdir
, newname
, error
),
755 __string(oldname
, oldname
->name
)
757 __string(newname
, newname
->name
)
761 __entry
->dev
= olddir
->i_sb
->s_dev
;
762 __entry
->olddir
= NFS_FILEID(olddir
);
763 __entry
->newdir
= NFS_FILEID(newdir
);
764 __entry
->error
= error
;
765 __assign_str(oldname
, oldname
->name
);
766 __assign_str(newname
, newname
->name
);
770 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
771 "newname=%02x:%02x:%llu/%s",
773 show_nfsv4_errors(__entry
->error
),
774 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
775 (unsigned long long)__entry
->olddir
,
777 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
778 (unsigned long long)__entry
->newdir
,
783 DECLARE_EVENT_CLASS(nfs4_inode_event
,
785 const struct inode
*inode
,
789 TP_ARGS(inode
, error
),
793 __field(u32
, fhandle
)
799 __entry
->dev
= inode
->i_sb
->s_dev
;
800 __entry
->fileid
= NFS_FILEID(inode
);
801 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
802 __entry
->error
= error
;
806 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
808 show_nfsv4_errors(__entry
->error
),
809 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
810 (unsigned long long)__entry
->fileid
,
815 #define DEFINE_NFS4_INODE_EVENT(name) \
816 DEFINE_EVENT(nfs4_inode_event, name, \
818 const struct inode *inode, \
821 TP_ARGS(inode, error))
823 DEFINE_NFS4_INODE_EVENT(nfs4_setattr
);
824 DEFINE_NFS4_INODE_EVENT(nfs4_access
);
825 DEFINE_NFS4_INODE_EVENT(nfs4_readlink
);
826 DEFINE_NFS4_INODE_EVENT(nfs4_readdir
);
827 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl
);
828 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl
);
829 #ifdef CONFIG_NFS_V4_SECURITY_LABEL
830 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label
);
831 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label
);
832 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
833 DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation
);
834 DEFINE_NFS4_INODE_EVENT(nfs4_delegreturn
);
836 DECLARE_EVENT_CLASS(nfs4_getattr_event
,
838 const struct nfs_server
*server
,
839 const struct nfs_fh
*fhandle
,
840 const struct nfs_fattr
*fattr
,
844 TP_ARGS(server
, fhandle
, fattr
, error
),
848 __field(u32
, fhandle
)
850 __field(unsigned int, valid
)
855 __entry
->dev
= server
->s_dev
;
856 __entry
->valid
= fattr
->valid
;
857 __entry
->fhandle
= nfs_fhandle_hash(fhandle
);
858 __entry
->fileid
= (fattr
->valid
& NFS_ATTR_FATTR_FILEID
) ? fattr
->fileid
: 0;
859 __entry
->error
= error
;
863 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
866 show_nfsv4_errors(__entry
->error
),
867 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
868 (unsigned long long)__entry
->fileid
,
870 show_nfs_fattr_flags(__entry
->valid
)
874 #define DEFINE_NFS4_GETATTR_EVENT(name) \
875 DEFINE_EVENT(nfs4_getattr_event, name, \
877 const struct nfs_server *server, \
878 const struct nfs_fh *fhandle, \
879 const struct nfs_fattr *fattr, \
882 TP_ARGS(server, fhandle, fattr, error))
883 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr
);
884 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root
);
885 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo
);
887 DECLARE_EVENT_CLASS(nfs4_idmap_event
,
895 TP_ARGS(name
, len
, id
, error
),
900 __dynamic_array(char, name
, len
> 0 ? len
+ 1 : 1)
906 __entry
->error
= error
< 0 ? error
: 0;
908 memcpy(__get_dynamic_array(name
), name
, len
);
909 ((char *)__get_dynamic_array(name
))[len
] = 0;
913 "error=%d id=%u name=%s",
919 #define DEFINE_NFS4_IDMAP_EVENT(name) \
920 DEFINE_EVENT(nfs4_idmap_event, name, \
927 TP_ARGS(name, len, id, error))
928 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid
);
929 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid
);
930 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name
);
931 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group
);
933 DECLARE_EVENT_CLASS(nfs4_read_event
,
935 const struct nfs_pgio_header
*hdr
,
943 __field(u32
, fhandle
)
945 __field(loff_t
, offset
)
946 __field(size_t, count
)
951 const struct inode
*inode
= hdr
->inode
;
952 __entry
->dev
= inode
->i_sb
->s_dev
;
953 __entry
->fileid
= NFS_FILEID(inode
);
954 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
955 __entry
->offset
= hdr
->args
.offset
;
956 __entry
->count
= hdr
->args
.count
;
957 __entry
->error
= error
;
961 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
962 "offset=%lld count=%zu",
964 show_nfsv4_errors(__entry
->error
),
965 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
966 (unsigned long long)__entry
->fileid
,
968 (long long)__entry
->offset
,
972 #define DEFINE_NFS4_READ_EVENT(name) \
973 DEFINE_EVENT(nfs4_read_event, name, \
975 const struct nfs_pgio_header *hdr, \
979 DEFINE_NFS4_READ_EVENT(nfs4_read
);
980 #ifdef CONFIG_NFS_V4_1
981 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read
);
982 #endif /* CONFIG_NFS_V4_1 */
984 DECLARE_EVENT_CLASS(nfs4_write_event
,
986 const struct nfs_pgio_header
*hdr
,
994 __field(u32
, fhandle
)
996 __field(loff_t
, offset
)
997 __field(size_t, count
)
1002 const struct inode
*inode
= hdr
->inode
;
1003 __entry
->dev
= inode
->i_sb
->s_dev
;
1004 __entry
->fileid
= NFS_FILEID(inode
);
1005 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
1006 __entry
->offset
= hdr
->args
.offset
;
1007 __entry
->count
= hdr
->args
.count
;
1008 __entry
->error
= error
;
1012 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1013 "offset=%lld count=%zu",
1015 show_nfsv4_errors(__entry
->error
),
1016 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
1017 (unsigned long long)__entry
->fileid
,
1019 (long long)__entry
->offset
,
1024 #define DEFINE_NFS4_WRITE_EVENT(name) \
1025 DEFINE_EVENT(nfs4_write_event, name, \
1027 const struct nfs_pgio_header *hdr, \
1030 TP_ARGS(hdr, error))
1031 DEFINE_NFS4_WRITE_EVENT(nfs4_write
);
1032 #ifdef CONFIG_NFS_V4_1
1033 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write
);
1034 #endif /* CONFIG_NFS_V4_1 */
1036 DECLARE_EVENT_CLASS(nfs4_commit_event
,
1038 const struct nfs_commit_data
*data
,
1042 TP_ARGS(data
, error
),
1046 __field(u32
, fhandle
)
1047 __field(u64
, fileid
)
1048 __field(loff_t
, offset
)
1049 __field(size_t, count
)
1054 const struct inode
*inode
= data
->inode
;
1055 __entry
->dev
= inode
->i_sb
->s_dev
;
1056 __entry
->fileid
= NFS_FILEID(inode
);
1057 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
1058 __entry
->offset
= data
->args
.offset
;
1059 __entry
->count
= data
->args
.count
;
1060 __entry
->error
= error
;
1064 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1065 "offset=%lld count=%zu",
1067 show_nfsv4_errors(__entry
->error
),
1068 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
1069 (unsigned long long)__entry
->fileid
,
1071 (long long)__entry
->offset
,
1075 #define DEFINE_NFS4_COMMIT_EVENT(name) \
1076 DEFINE_EVENT(nfs4_commit_event, name, \
1078 const struct nfs_commit_data *data, \
1081 TP_ARGS(data, error))
1082 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit
);
1083 #ifdef CONFIG_NFS_V4_1
1084 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds
);
1086 #define show_pnfs_iomode(iomode) \
1087 __print_symbolic(iomode, \
1088 { IOMODE_READ, "READ" }, \
1089 { IOMODE_RW, "RW" }, \
1090 { IOMODE_ANY, "ANY" })
1092 TRACE_EVENT(nfs4_layoutget
,
1094 const struct nfs_open_context
*ctx
,
1095 const struct pnfs_layout_range
*args
,
1096 const struct pnfs_layout_range
*res
,
1100 TP_ARGS(ctx
, args
, res
, error
),
1104 __field(u32
, fhandle
)
1105 __field(u64
, fileid
)
1106 __field(u32
, iomode
)
1107 __field(u64
, offset
)
1113 const struct inode
*inode
= d_inode(ctx
->dentry
);
1114 __entry
->dev
= inode
->i_sb
->s_dev
;
1115 __entry
->fileid
= NFS_FILEID(inode
);
1116 __entry
->fhandle
= nfs_fhandle_hash(NFS_FH(inode
));
1117 __entry
->iomode
= args
->iomode
;
1118 __entry
->offset
= args
->offset
;
1119 __entry
->count
= args
->length
;
1120 __entry
->error
= error
;
1124 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1125 "iomode=%s offset=%llu count=%llu",
1127 show_nfsv4_errors(__entry
->error
),
1128 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
1129 (unsigned long long)__entry
->fileid
,
1131 show_pnfs_iomode(__entry
->iomode
),
1132 (unsigned long long)__entry
->offset
,
1133 (unsigned long long)__entry
->count
1137 DEFINE_NFS4_INODE_EVENT(nfs4_layoutcommit
);
1138 DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn
);
1140 #endif /* CONFIG_NFS_V4_1 */
1142 #endif /* _TRACE_NFS4_H */
1144 #undef TRACE_INCLUDE_PATH
1145 #define TRACE_INCLUDE_PATH .
1146 #define TRACE_INCLUDE_FILE nfs4trace
1147 /* This part must be outside protection */
1148 #include <trace/define_trace.h>