blob: e3586c16ef5924c189b40b12ec73b54618fae3ee [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002/*
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4 */
5#undef TRACE_SYSTEM
6#define TRACE_SYSTEM nfs4
7
8#if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
9#define _TRACE_NFS4_H
10
11#include <linux/tracepoint.h>
12
Chuck Lever5b2095d2018-12-19 11:00:11 -050013TRACE_DEFINE_ENUM(EPERM);
14TRACE_DEFINE_ENUM(ENOENT);
15TRACE_DEFINE_ENUM(EIO);
16TRACE_DEFINE_ENUM(ENXIO);
17TRACE_DEFINE_ENUM(EACCES);
18TRACE_DEFINE_ENUM(EEXIST);
19TRACE_DEFINE_ENUM(EXDEV);
20TRACE_DEFINE_ENUM(ENOTDIR);
21TRACE_DEFINE_ENUM(EISDIR);
22TRACE_DEFINE_ENUM(EFBIG);
23TRACE_DEFINE_ENUM(ENOSPC);
24TRACE_DEFINE_ENUM(EROFS);
25TRACE_DEFINE_ENUM(EMLINK);
26TRACE_DEFINE_ENUM(ENAMETOOLONG);
27TRACE_DEFINE_ENUM(ENOTEMPTY);
28TRACE_DEFINE_ENUM(EDQUOT);
29TRACE_DEFINE_ENUM(ESTALE);
30TRACE_DEFINE_ENUM(EBADHANDLE);
31TRACE_DEFINE_ENUM(EBADCOOKIE);
32TRACE_DEFINE_ENUM(ENOTSUPP);
33TRACE_DEFINE_ENUM(ETOOSMALL);
34TRACE_DEFINE_ENUM(EREMOTEIO);
35TRACE_DEFINE_ENUM(EBADTYPE);
36TRACE_DEFINE_ENUM(EAGAIN);
37TRACE_DEFINE_ENUM(ELOOP);
38TRACE_DEFINE_ENUM(EOPNOTSUPP);
39TRACE_DEFINE_ENUM(EDEADLK);
40TRACE_DEFINE_ENUM(ENOMEM);
41TRACE_DEFINE_ENUM(EKEYEXPIRED);
42TRACE_DEFINE_ENUM(ETIMEDOUT);
43TRACE_DEFINE_ENUM(ERESTARTSYS);
44TRACE_DEFINE_ENUM(ECONNREFUSED);
45TRACE_DEFINE_ENUM(ECONNRESET);
46TRACE_DEFINE_ENUM(ENETUNREACH);
47TRACE_DEFINE_ENUM(EHOSTUNREACH);
48TRACE_DEFINE_ENUM(EHOSTDOWN);
49TRACE_DEFINE_ENUM(EPIPE);
50TRACE_DEFINE_ENUM(EPFNOSUPPORT);
51TRACE_DEFINE_ENUM(EPROTONOSUPPORT);
52
53TRACE_DEFINE_ENUM(NFS4_OK);
54TRACE_DEFINE_ENUM(NFS4ERR_ACCESS);
55TRACE_DEFINE_ENUM(NFS4ERR_ATTRNOTSUPP);
56TRACE_DEFINE_ENUM(NFS4ERR_ADMIN_REVOKED);
57TRACE_DEFINE_ENUM(NFS4ERR_BACK_CHAN_BUSY);
58TRACE_DEFINE_ENUM(NFS4ERR_BADCHAR);
59TRACE_DEFINE_ENUM(NFS4ERR_BADHANDLE);
60TRACE_DEFINE_ENUM(NFS4ERR_BADIOMODE);
61TRACE_DEFINE_ENUM(NFS4ERR_BADLAYOUT);
62TRACE_DEFINE_ENUM(NFS4ERR_BADLABEL);
63TRACE_DEFINE_ENUM(NFS4ERR_BADNAME);
64TRACE_DEFINE_ENUM(NFS4ERR_BADOWNER);
65TRACE_DEFINE_ENUM(NFS4ERR_BADSESSION);
66TRACE_DEFINE_ENUM(NFS4ERR_BADSLOT);
67TRACE_DEFINE_ENUM(NFS4ERR_BADTYPE);
68TRACE_DEFINE_ENUM(NFS4ERR_BADXDR);
69TRACE_DEFINE_ENUM(NFS4ERR_BAD_COOKIE);
70TRACE_DEFINE_ENUM(NFS4ERR_BAD_HIGH_SLOT);
71TRACE_DEFINE_ENUM(NFS4ERR_BAD_RANGE);
72TRACE_DEFINE_ENUM(NFS4ERR_BAD_SEQID);
73TRACE_DEFINE_ENUM(NFS4ERR_BAD_SESSION_DIGEST);
74TRACE_DEFINE_ENUM(NFS4ERR_BAD_STATEID);
75TRACE_DEFINE_ENUM(NFS4ERR_CB_PATH_DOWN);
76TRACE_DEFINE_ENUM(NFS4ERR_CLID_INUSE);
77TRACE_DEFINE_ENUM(NFS4ERR_CLIENTID_BUSY);
78TRACE_DEFINE_ENUM(NFS4ERR_COMPLETE_ALREADY);
79TRACE_DEFINE_ENUM(NFS4ERR_CONN_NOT_BOUND_TO_SESSION);
80TRACE_DEFINE_ENUM(NFS4ERR_DEADLOCK);
81TRACE_DEFINE_ENUM(NFS4ERR_DEADSESSION);
82TRACE_DEFINE_ENUM(NFS4ERR_DELAY);
83TRACE_DEFINE_ENUM(NFS4ERR_DELEG_ALREADY_WANTED);
84TRACE_DEFINE_ENUM(NFS4ERR_DELEG_REVOKED);
85TRACE_DEFINE_ENUM(NFS4ERR_DENIED);
86TRACE_DEFINE_ENUM(NFS4ERR_DIRDELEG_UNAVAIL);
87TRACE_DEFINE_ENUM(NFS4ERR_DQUOT);
88TRACE_DEFINE_ENUM(NFS4ERR_ENCR_ALG_UNSUPP);
89TRACE_DEFINE_ENUM(NFS4ERR_EXIST);
90TRACE_DEFINE_ENUM(NFS4ERR_EXPIRED);
91TRACE_DEFINE_ENUM(NFS4ERR_FBIG);
92TRACE_DEFINE_ENUM(NFS4ERR_FHEXPIRED);
93TRACE_DEFINE_ENUM(NFS4ERR_FILE_OPEN);
94TRACE_DEFINE_ENUM(NFS4ERR_GRACE);
95TRACE_DEFINE_ENUM(NFS4ERR_HASH_ALG_UNSUPP);
96TRACE_DEFINE_ENUM(NFS4ERR_INVAL);
97TRACE_DEFINE_ENUM(NFS4ERR_IO);
98TRACE_DEFINE_ENUM(NFS4ERR_ISDIR);
99TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTTRYLATER);
100TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTUNAVAILABLE);
101TRACE_DEFINE_ENUM(NFS4ERR_LEASE_MOVED);
102TRACE_DEFINE_ENUM(NFS4ERR_LOCKED);
103TRACE_DEFINE_ENUM(NFS4ERR_LOCKS_HELD);
104TRACE_DEFINE_ENUM(NFS4ERR_LOCK_RANGE);
105TRACE_DEFINE_ENUM(NFS4ERR_MINOR_VERS_MISMATCH);
106TRACE_DEFINE_ENUM(NFS4ERR_MLINK);
107TRACE_DEFINE_ENUM(NFS4ERR_MOVED);
108TRACE_DEFINE_ENUM(NFS4ERR_NAMETOOLONG);
109TRACE_DEFINE_ENUM(NFS4ERR_NOENT);
110TRACE_DEFINE_ENUM(NFS4ERR_NOFILEHANDLE);
111TRACE_DEFINE_ENUM(NFS4ERR_NOMATCHING_LAYOUT);
112TRACE_DEFINE_ENUM(NFS4ERR_NOSPC);
113TRACE_DEFINE_ENUM(NFS4ERR_NOTDIR);
114TRACE_DEFINE_ENUM(NFS4ERR_NOTEMPTY);
115TRACE_DEFINE_ENUM(NFS4ERR_NOTSUPP);
116TRACE_DEFINE_ENUM(NFS4ERR_NOT_ONLY_OP);
117TRACE_DEFINE_ENUM(NFS4ERR_NOT_SAME);
118TRACE_DEFINE_ENUM(NFS4ERR_NO_GRACE);
119TRACE_DEFINE_ENUM(NFS4ERR_NXIO);
120TRACE_DEFINE_ENUM(NFS4ERR_OLD_STATEID);
121TRACE_DEFINE_ENUM(NFS4ERR_OPENMODE);
122TRACE_DEFINE_ENUM(NFS4ERR_OP_ILLEGAL);
123TRACE_DEFINE_ENUM(NFS4ERR_OP_NOT_IN_SESSION);
124TRACE_DEFINE_ENUM(NFS4ERR_PERM);
125TRACE_DEFINE_ENUM(NFS4ERR_PNFS_IO_HOLE);
126TRACE_DEFINE_ENUM(NFS4ERR_PNFS_NO_LAYOUT);
127TRACE_DEFINE_ENUM(NFS4ERR_RECALLCONFLICT);
128TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_BAD);
129TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_CONFLICT);
130TRACE_DEFINE_ENUM(NFS4ERR_REJECT_DELEG);
131TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG);
132TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG_TO_CACHE);
133TRACE_DEFINE_ENUM(NFS4ERR_REQ_TOO_BIG);
134TRACE_DEFINE_ENUM(NFS4ERR_RESOURCE);
135TRACE_DEFINE_ENUM(NFS4ERR_RESTOREFH);
136TRACE_DEFINE_ENUM(NFS4ERR_RETRY_UNCACHED_REP);
137TRACE_DEFINE_ENUM(NFS4ERR_RETURNCONFLICT);
138TRACE_DEFINE_ENUM(NFS4ERR_ROFS);
139TRACE_DEFINE_ENUM(NFS4ERR_SAME);
140TRACE_DEFINE_ENUM(NFS4ERR_SHARE_DENIED);
141TRACE_DEFINE_ENUM(NFS4ERR_SEQUENCE_POS);
142TRACE_DEFINE_ENUM(NFS4ERR_SEQ_FALSE_RETRY);
143TRACE_DEFINE_ENUM(NFS4ERR_SEQ_MISORDERED);
144TRACE_DEFINE_ENUM(NFS4ERR_SERVERFAULT);
145TRACE_DEFINE_ENUM(NFS4ERR_STALE);
146TRACE_DEFINE_ENUM(NFS4ERR_STALE_CLIENTID);
147TRACE_DEFINE_ENUM(NFS4ERR_STALE_STATEID);
148TRACE_DEFINE_ENUM(NFS4ERR_SYMLINK);
149TRACE_DEFINE_ENUM(NFS4ERR_TOOSMALL);
150TRACE_DEFINE_ENUM(NFS4ERR_TOO_MANY_OPS);
151TRACE_DEFINE_ENUM(NFS4ERR_UNKNOWN_LAYOUTTYPE);
152TRACE_DEFINE_ENUM(NFS4ERR_UNSAFE_COMPOUND);
153TRACE_DEFINE_ENUM(NFS4ERR_WRONGSEC);
154TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED);
155TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE);
156TRACE_DEFINE_ENUM(NFS4ERR_XDEV);
157
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400158#define show_nfsv4_errors(error) \
Chuck Lever96650e22019-06-19 10:33:53 -0400159 __print_symbolic(error, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400160 { NFS4_OK, "OK" }, \
161 /* Mapped by nfs4_stat_to_errno() */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500162 { EPERM, "EPERM" }, \
163 { ENOENT, "ENOENT" }, \
164 { EIO, "EIO" }, \
165 { ENXIO, "ENXIO" }, \
166 { EACCES, "EACCES" }, \
167 { EEXIST, "EEXIST" }, \
168 { EXDEV, "EXDEV" }, \
169 { ENOTDIR, "ENOTDIR" }, \
170 { EISDIR, "EISDIR" }, \
171 { EFBIG, "EFBIG" }, \
172 { ENOSPC, "ENOSPC" }, \
173 { EROFS, "EROFS" }, \
174 { EMLINK, "EMLINK" }, \
175 { ENAMETOOLONG, "ENAMETOOLONG" }, \
176 { ENOTEMPTY, "ENOTEMPTY" }, \
177 { EDQUOT, "EDQUOT" }, \
178 { ESTALE, "ESTALE" }, \
179 { EBADHANDLE, "EBADHANDLE" }, \
180 { EBADCOOKIE, "EBADCOOKIE" }, \
181 { ENOTSUPP, "ENOTSUPP" }, \
182 { ETOOSMALL, "ETOOSMALL" }, \
183 { EREMOTEIO, "EREMOTEIO" }, \
184 { EBADTYPE, "EBADTYPE" }, \
185 { EAGAIN, "EAGAIN" }, \
186 { ELOOP, "ELOOP" }, \
187 { EOPNOTSUPP, "EOPNOTSUPP" }, \
188 { EDEADLK, "EDEADLK" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400189 /* RPC errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500190 { ENOMEM, "ENOMEM" }, \
191 { EKEYEXPIRED, "EKEYEXPIRED" }, \
192 { ETIMEDOUT, "ETIMEDOUT" }, \
193 { ERESTARTSYS, "ERESTARTSYS" }, \
194 { ECONNREFUSED, "ECONNREFUSED" }, \
195 { ECONNRESET, "ECONNRESET" }, \
196 { ENETUNREACH, "ENETUNREACH" }, \
197 { EHOSTUNREACH, "EHOSTUNREACH" }, \
198 { EHOSTDOWN, "EHOSTDOWN" }, \
199 { EPIPE, "EPIPE" }, \
200 { EPFNOSUPPORT, "EPFNOSUPPORT" }, \
201 { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400202 /* NFSv4 native errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500203 { NFS4ERR_ACCESS, "ACCESS" }, \
204 { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
205 { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
206 { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
207 { NFS4ERR_BADCHAR, "BADCHAR" }, \
208 { NFS4ERR_BADHANDLE, "BADHANDLE" }, \
209 { NFS4ERR_BADIOMODE, "BADIOMODE" }, \
210 { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
211 { NFS4ERR_BADLABEL, "BADLABEL" }, \
212 { NFS4ERR_BADNAME, "BADNAME" }, \
213 { NFS4ERR_BADOWNER, "BADOWNER" }, \
214 { NFS4ERR_BADSESSION, "BADSESSION" }, \
215 { NFS4ERR_BADSLOT, "BADSLOT" }, \
216 { NFS4ERR_BADTYPE, "BADTYPE" }, \
217 { NFS4ERR_BADXDR, "BADXDR" }, \
218 { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
219 { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
220 { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
221 { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
222 { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
223 { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
224 { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
225 { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
226 { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
227 { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
228 { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400229 "CONN_NOT_BOUND_TO_SESSION" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500230 { NFS4ERR_DEADLOCK, "DEADLOCK" }, \
231 { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
232 { NFS4ERR_DELAY, "DELAY" }, \
233 { NFS4ERR_DELEG_ALREADY_WANTED, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400234 "DELEG_ALREADY_WANTED" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500235 { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
236 { NFS4ERR_DENIED, "DENIED" }, \
237 { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
238 { NFS4ERR_DQUOT, "DQUOT" }, \
239 { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
240 { NFS4ERR_EXIST, "EXIST" }, \
241 { NFS4ERR_EXPIRED, "EXPIRED" }, \
242 { NFS4ERR_FBIG, "FBIG" }, \
243 { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
244 { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
245 { NFS4ERR_GRACE, "GRACE" }, \
246 { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
247 { NFS4ERR_INVAL, "INVAL" }, \
248 { NFS4ERR_IO, "IO" }, \
249 { NFS4ERR_ISDIR, "ISDIR" }, \
250 { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
251 { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
252 { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
253 { NFS4ERR_LOCKED, "LOCKED" }, \
254 { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
255 { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
256 { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
257 { NFS4ERR_MLINK, "MLINK" }, \
258 { NFS4ERR_MOVED, "MOVED" }, \
259 { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
260 { NFS4ERR_NOENT, "NOENT" }, \
261 { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
262 { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
263 { NFS4ERR_NOSPC, "NOSPC" }, \
264 { NFS4ERR_NOTDIR, "NOTDIR" }, \
265 { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
266 { NFS4ERR_NOTSUPP, "NOTSUPP" }, \
267 { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
268 { NFS4ERR_NOT_SAME, "NOT_SAME" }, \
269 { NFS4ERR_NO_GRACE, "NO_GRACE" }, \
270 { NFS4ERR_NXIO, "NXIO" }, \
271 { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
272 { NFS4ERR_OPENMODE, "OPENMODE" }, \
273 { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
274 { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
275 { NFS4ERR_PERM, "PERM" }, \
276 { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
277 { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
278 { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
279 { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
280 { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
281 { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
282 { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
283 { NFS4ERR_REP_TOO_BIG_TO_CACHE, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400284 "REP_TOO_BIG_TO_CACHE" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500285 { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
286 { NFS4ERR_RESOURCE, "RESOURCE" }, \
287 { NFS4ERR_RESTOREFH, "RESTOREFH" }, \
288 { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
289 { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
290 { NFS4ERR_ROFS, "ROFS" }, \
291 { NFS4ERR_SAME, "SAME" }, \
292 { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
293 { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
294 { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
295 { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
296 { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
297 { NFS4ERR_STALE, "STALE" }, \
298 { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
299 { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
300 { NFS4ERR_SYMLINK, "SYMLINK" }, \
301 { NFS4ERR_TOOSMALL, "TOOSMALL" }, \
302 { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
303 { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
304 { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
305 { NFS4ERR_WRONGSEC, "WRONGSEC" }, \
306 { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
307 { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
308 { NFS4ERR_XDEV, "XDEV" })
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400309
Trond Myklebust42113a72013-08-12 16:19:27 -0400310#define show_open_flags(flags) \
311 __print_flags(flags, "|", \
312 { O_CREAT, "O_CREAT" }, \
313 { O_EXCL, "O_EXCL" }, \
314 { O_TRUNC, "O_TRUNC" }, \
315 { O_DIRECT, "O_DIRECT" })
316
317#define show_fmode_flags(mode) \
318 __print_flags(mode, "|", \
319 { ((__force unsigned long)FMODE_READ), "READ" }, \
320 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
321 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
322
Trond Myklebustb5f875a2013-08-13 13:01:39 -0400323#define show_nfs_fattr_flags(valid) \
324 __print_flags((unsigned long)valid, "|", \
325 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
326 { NFS_ATTR_FATTR_MODE, "MODE" }, \
327 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
328 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
329 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
330 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
331 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
332 { NFS_ATTR_FATTR_FSID, "FSID" }, \
333 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
334 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
335 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
336 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
337 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
338 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
339 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
340
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400341DECLARE_EVENT_CLASS(nfs4_clientid_event,
342 TP_PROTO(
343 const struct nfs_client *clp,
344 int error
345 ),
346
347 TP_ARGS(clp, error),
348
349 TP_STRUCT__entry(
Anna Schumaker39443692017-11-01 15:48:43 -0400350 __string(dstaddr, clp->cl_hostname)
Chuck Lever96650e22019-06-19 10:33:53 -0400351 __field(unsigned long, error)
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400352 ),
353
354 TP_fast_assign(
355 __entry->error = error;
Anna Schumaker39443692017-11-01 15:48:43 -0400356 __assign_str(dstaddr, clp->cl_hostname);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400357 ),
358
359 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400360 "error=%ld (%s) dstaddr=%s",
361 -__entry->error,
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400362 show_nfsv4_errors(__entry->error),
363 __get_str(dstaddr)
364 )
365);
366#define DEFINE_NFS4_CLIENTID_EVENT(name) \
367 DEFINE_EVENT(nfs4_clientid_event, name, \
368 TP_PROTO( \
369 const struct nfs_client *clp, \
370 int error \
371 ), \
372 TP_ARGS(clp, error))
373DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
374DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
375DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
376DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
377#ifdef CONFIG_NFS_V4_1
378DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
379DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
380DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
381DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
382DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
383DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
384DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400385
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400386#define show_nfs4_sequence_status_flags(status) \
387 __print_flags((unsigned long)status, "|", \
388 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
389 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
390 "CB_GSS_CONTEXTS_EXPIRING" }, \
391 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
392 "CB_GSS_CONTEXTS_EXPIRED" }, \
393 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
394 "EXPIRED_ALL_STATE_REVOKED" }, \
395 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
396 "EXPIRED_SOME_STATE_REVOKED" }, \
397 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
398 "ADMIN_STATE_REVOKED" }, \
399 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
400 "RECALLABLE_STATE_REVOKED" }, \
401 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
402 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
403 "RESTART_RECLAIM_NEEDED" }, \
404 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
405 "CB_PATH_DOWN_SESSION" }, \
406 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
407 "BACKCHANNEL_FAULT" })
408
409TRACE_EVENT(nfs4_sequence_done,
410 TP_PROTO(
411 const struct nfs4_session *session,
412 const struct nfs4_sequence_res *res
413 ),
414 TP_ARGS(session, res),
415
416 TP_STRUCT__entry(
417 __field(unsigned int, session)
418 __field(unsigned int, slot_nr)
419 __field(unsigned int, seq_nr)
420 __field(unsigned int, highest_slotid)
421 __field(unsigned int, target_highest_slotid)
422 __field(unsigned int, status_flags)
Chuck Lever96650e22019-06-19 10:33:53 -0400423 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400424 ),
425
426 TP_fast_assign(
427 const struct nfs4_slot *sr_slot = res->sr_slot;
428 __entry->session = nfs_session_id_hash(&session->sess_id);
429 __entry->slot_nr = sr_slot->slot_nr;
430 __entry->seq_nr = sr_slot->seq_nr;
431 __entry->highest_slotid = res->sr_highest_slotid;
432 __entry->target_highest_slotid =
433 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500434 __entry->status_flags = res->sr_status_flags;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400435 __entry->error = res->sr_status;
436 ),
437 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400438 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400439 "highest_slotid=%u target_highest_slotid=%u "
440 "status_flags=%u (%s)",
Chuck Lever96650e22019-06-19 10:33:53 -0400441 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400442 show_nfsv4_errors(__entry->error),
443 __entry->session,
444 __entry->slot_nr,
445 __entry->seq_nr,
446 __entry->highest_slotid,
447 __entry->target_highest_slotid,
448 __entry->status_flags,
449 show_nfs4_sequence_status_flags(__entry->status_flags)
450 )
451);
452
453struct cb_sequenceargs;
454struct cb_sequenceres;
455
456TRACE_EVENT(nfs4_cb_sequence,
457 TP_PROTO(
458 const struct cb_sequenceargs *args,
459 const struct cb_sequenceres *res,
460 __be32 status
461 ),
462 TP_ARGS(args, res, status),
463
464 TP_STRUCT__entry(
465 __field(unsigned int, session)
466 __field(unsigned int, slot_nr)
467 __field(unsigned int, seq_nr)
468 __field(unsigned int, highest_slotid)
469 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400470 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400471 ),
472
473 TP_fast_assign(
474 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
475 __entry->slot_nr = args->csa_slotid;
476 __entry->seq_nr = args->csa_sequenceid;
477 __entry->highest_slotid = args->csa_highestslotid;
478 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400479 __entry->error = be32_to_cpu(status);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400480 ),
481
482 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400483 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400484 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400485 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400486 show_nfsv4_errors(__entry->error),
487 __entry->session,
488 __entry->slot_nr,
489 __entry->seq_nr,
490 __entry->highest_slotid
491 )
492);
Chuck Leverc5833f02019-06-19 10:33:47 -0400493
494TRACE_EVENT(nfs4_cb_seqid_err,
495 TP_PROTO(
496 const struct cb_sequenceargs *args,
497 __be32 status
498 ),
499 TP_ARGS(args, status),
500
501 TP_STRUCT__entry(
502 __field(unsigned int, session)
503 __field(unsigned int, slot_nr)
504 __field(unsigned int, seq_nr)
505 __field(unsigned int, highest_slotid)
506 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400507 __field(unsigned long, error)
Chuck Leverc5833f02019-06-19 10:33:47 -0400508 ),
509
510 TP_fast_assign(
511 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
512 __entry->slot_nr = args->csa_slotid;
513 __entry->seq_nr = args->csa_sequenceid;
514 __entry->highest_slotid = args->csa_highestslotid;
515 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400516 __entry->error = be32_to_cpu(status);
Chuck Leverc5833f02019-06-19 10:33:47 -0400517 ),
518
519 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400520 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Chuck Leverc5833f02019-06-19 10:33:47 -0400521 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400522 -__entry->error,
Chuck Leverc5833f02019-06-19 10:33:47 -0400523 show_nfsv4_errors(__entry->error),
524 __entry->session,
525 __entry->slot_nr,
526 __entry->seq_nr,
527 __entry->highest_slotid
528 )
529);
530
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400531#endif /* CONFIG_NFS_V4_1 */
532
Anna Schumakerad05cc02017-01-11 13:37:06 -0500533TRACE_EVENT(nfs4_setup_sequence,
534 TP_PROTO(
535 const struct nfs4_session *session,
536 const struct nfs4_sequence_args *args
537 ),
538 TP_ARGS(session, args),
539
540 TP_STRUCT__entry(
541 __field(unsigned int, session)
542 __field(unsigned int, slot_nr)
543 __field(unsigned int, seq_nr)
544 __field(unsigned int, highest_used_slotid)
545 ),
546
547 TP_fast_assign(
548 const struct nfs4_slot *sa_slot = args->sa_slot;
549 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
550 __entry->slot_nr = sa_slot->slot_nr;
551 __entry->seq_nr = sa_slot->seq_nr;
552 __entry->highest_used_slotid =
553 sa_slot->table->highest_used_slotid;
554 ),
555 TP_printk(
556 "session=0x%08x slot_nr=%u seq_nr=%u "
557 "highest_used_slotid=%u",
558 __entry->session,
559 __entry->slot_nr,
560 __entry->seq_nr,
561 __entry->highest_used_slotid
562 )
563);
564
Chuck Lever511ba522019-11-05 11:04:07 -0500565TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
566TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
567TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
568TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
569TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
570TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
571TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
572TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
573TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
574TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
575TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
576TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
577TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
578TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
579TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
580TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN_RUNNING);
581
582#define show_nfs4_clp_state(state) \
583 __print_flags(state, "|", \
584 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \
585 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \
586 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \
587 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
588 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
589 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \
590 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \
591 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \
592 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \
593 "SERVER_SCOPE_MISMATCH" }, \
594 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \
595 { NFS4CLNT_BIND_CONN_TO_SESSION, \
596 "BIND_CONN_TO_SESSION" }, \
597 { NFS4CLNT_MOVED, "MOVED" }, \
598 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \
599 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \
600 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \
601 { NFS4CLNT_DELEGRETURN_RUNNING, "DELEGRETURN_RUNNING" })
602
603TRACE_EVENT(nfs4_state_mgr,
604 TP_PROTO(
605 const struct nfs_client *clp
606 ),
607
608 TP_ARGS(clp),
609
610 TP_STRUCT__entry(
611 __field(unsigned long, state)
612 __string(hostname, clp->cl_hostname)
613 ),
614
615 TP_fast_assign(
616 __entry->state = clp->cl_state;
617 __assign_str(hostname, clp->cl_hostname)
618 ),
619
620 TP_printk(
621 "hostname=%s clp state=%s", __get_str(hostname),
622 show_nfs4_clp_state(__entry->state)
623 )
624)
625
626TRACE_EVENT(nfs4_state_mgr_failed,
627 TP_PROTO(
628 const struct nfs_client *clp,
629 const char *section,
630 int status
631 ),
632
633 TP_ARGS(clp, section, status),
634
635 TP_STRUCT__entry(
636 __field(unsigned long, error)
637 __field(unsigned long, state)
638 __string(hostname, clp->cl_hostname)
639 __string(section, section)
640 ),
641
642 TP_fast_assign(
643 __entry->error = status;
644 __entry->state = clp->cl_state;
645 __assign_str(hostname, clp->cl_hostname);
646 __assign_str(section, section);
647 ),
648
649 TP_printk(
650 "hostname=%s clp state=%s error=%ld (%s) section=%s",
651 __get_str(hostname),
652 show_nfs4_clp_state(__entry->state), -__entry->error,
653 show_nfsv4_errors(__entry->error), __get_str(section)
654
655 )
656)
657
Chuck Leverf23f6582019-02-11 11:24:26 -0500658TRACE_EVENT(nfs4_xdr_status,
659 TP_PROTO(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400660 const struct xdr_stream *xdr,
Chuck Leverf23f6582019-02-11 11:24:26 -0500661 u32 op,
662 int error
663 ),
664
Chuck Lever62a92ba2019-06-19 10:34:09 -0400665 TP_ARGS(xdr, op, error),
Chuck Leverf23f6582019-02-11 11:24:26 -0500666
667 TP_STRUCT__entry(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400668 __field(unsigned int, task_id)
669 __field(unsigned int, client_id)
670 __field(u32, xid)
Chuck Leverf23f6582019-02-11 11:24:26 -0500671 __field(u32, op)
Chuck Lever96650e22019-06-19 10:33:53 -0400672 __field(unsigned long, error)
Chuck Leverf23f6582019-02-11 11:24:26 -0500673 ),
674
675 TP_fast_assign(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400676 const struct rpc_rqst *rqstp = xdr->rqst;
677 const struct rpc_task *task = rqstp->rq_task;
678
679 __entry->task_id = task->tk_pid;
680 __entry->client_id = task->tk_client->cl_clid;
681 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Leverf23f6582019-02-11 11:24:26 -0500682 __entry->op = op;
Chuck Lever96650e22019-06-19 10:33:53 -0400683 __entry->error = error;
Chuck Leverf23f6582019-02-11 11:24:26 -0500684 ),
685
686 TP_printk(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400687 "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u",
688 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever96650e22019-06-19 10:33:53 -0400689 -__entry->error, show_nfsv4_errors(__entry->error),
690 __entry->op
Chuck Leverf23f6582019-02-11 11:24:26 -0500691 )
692);
693
Chuck Lever2bb50aa2019-12-23 10:28:38 -0500694DECLARE_EVENT_CLASS(nfs4_cb_error_class,
695 TP_PROTO(
696 __be32 xid,
697 u32 cb_ident
698 ),
699
700 TP_ARGS(xid, cb_ident),
701
702 TP_STRUCT__entry(
703 __field(u32, xid)
704 __field(u32, cbident)
705 ),
706
707 TP_fast_assign(
708 __entry->xid = be32_to_cpu(xid);
709 __entry->cbident = cb_ident;
710 ),
711
712 TP_printk(
713 "xid=0x%08x cb_ident=0x%08x",
714 __entry->xid, __entry->cbident
715 )
716);
717
718#define DEFINE_CB_ERROR_EVENT(name) \
719 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
720 TP_PROTO( \
721 __be32 xid, \
722 u32 cb_ident \
723 ), \
724 TP_ARGS(xid, cb_ident))
725
726DEFINE_CB_ERROR_EVENT(no_clp);
727DEFINE_CB_ERROR_EVENT(badprinc);
728
Trond Myklebust42113a72013-08-12 16:19:27 -0400729DECLARE_EVENT_CLASS(nfs4_open_event,
730 TP_PROTO(
731 const struct nfs_open_context *ctx,
732 int flags,
733 int error
734 ),
735
736 TP_ARGS(ctx, flags, error),
737
738 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400739 __field(unsigned long, error)
Trond Myklebust42113a72013-08-12 16:19:27 -0400740 __field(unsigned int, flags)
741 __field(unsigned int, fmode)
742 __field(dev_t, dev)
743 __field(u32, fhandle)
744 __field(u64, fileid)
745 __field(u64, dir)
746 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500747 __field(int, stateid_seq)
748 __field(u32, stateid_hash)
749 __field(int, openstateid_seq)
750 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400751 ),
752
753 TP_fast_assign(
754 const struct nfs4_state *state = ctx->state;
755 const struct inode *inode = NULL;
756
Chuck Lever96650e22019-06-19 10:33:53 -0400757 __entry->error = -error;
Trond Myklebust42113a72013-08-12 16:19:27 -0400758 __entry->flags = flags;
759 __entry->fmode = (__force unsigned int)ctx->mode;
760 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500761 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400762 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500763 __entry->stateid_seq =
764 be32_to_cpu(state->stateid.seqid);
765 __entry->stateid_hash =
766 nfs_stateid_hash(&state->stateid);
767 __entry->openstateid_seq =
768 be32_to_cpu(state->open_stateid.seqid);
769 __entry->openstateid_hash =
770 nfs_stateid_hash(&state->open_stateid);
771 } else {
772 __entry->stateid_seq = 0;
773 __entry->stateid_hash = 0;
774 __entry->openstateid_seq = 0;
775 __entry->openstateid_hash = 0;
776 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400777 if (inode != NULL) {
778 __entry->fileid = NFS_FILEID(inode);
779 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
780 } else {
781 __entry->fileid = 0;
782 __entry->fhandle = 0;
783 }
David Howells2b0143b2015-03-17 22:25:59 +0000784 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400785 __assign_str(name, ctx->dentry->d_name.name);
786 ),
787
788 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400789 "error=%ld (%s) flags=%d (%s) fmode=%s "
Trond Myklebust42113a72013-08-12 16:19:27 -0400790 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500791 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
792 "openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400793 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400794 show_nfsv4_errors(__entry->error),
795 __entry->flags,
796 show_open_flags(__entry->flags),
797 show_fmode_flags(__entry->fmode),
798 MAJOR(__entry->dev), MINOR(__entry->dev),
799 (unsigned long long)__entry->fileid,
800 __entry->fhandle,
801 MAJOR(__entry->dev), MINOR(__entry->dev),
802 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500803 __get_str(name),
804 __entry->stateid_seq, __entry->stateid_hash,
805 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400806 )
807);
808
809#define DEFINE_NFS4_OPEN_EVENT(name) \
810 DEFINE_EVENT(nfs4_open_event, name, \
811 TP_PROTO( \
812 const struct nfs_open_context *ctx, \
813 int flags, \
814 int error \
815 ), \
816 TP_ARGS(ctx, flags, error))
817DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
818DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
819DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
820
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500821TRACE_EVENT(nfs4_cached_open,
822 TP_PROTO(
823 const struct nfs4_state *state
824 ),
825 TP_ARGS(state),
826 TP_STRUCT__entry(
827 __field(dev_t, dev)
828 __field(u32, fhandle)
829 __field(u64, fileid)
830 __field(unsigned int, fmode)
831 __field(int, stateid_seq)
832 __field(u32, stateid_hash)
833 ),
834
835 TP_fast_assign(
836 const struct inode *inode = state->inode;
837
838 __entry->dev = inode->i_sb->s_dev;
839 __entry->fileid = NFS_FILEID(inode);
840 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
841 __entry->fmode = (__force unsigned int)state->state;
842 __entry->stateid_seq =
843 be32_to_cpu(state->stateid.seqid);
844 __entry->stateid_hash =
845 nfs_stateid_hash(&state->stateid);
846 ),
847
848 TP_printk(
849 "fmode=%s fileid=%02x:%02x:%llu "
850 "fhandle=0x%08x stateid=%d:0x%08x",
851 __entry->fmode ? show_fmode_flags(__entry->fmode) :
852 "closed",
853 MAJOR(__entry->dev), MINOR(__entry->dev),
854 (unsigned long long)__entry->fileid,
855 __entry->fhandle,
856 __entry->stateid_seq, __entry->stateid_hash
857 )
858);
859
Trond Myklebust42113a72013-08-12 16:19:27 -0400860TRACE_EVENT(nfs4_close,
861 TP_PROTO(
862 const struct nfs4_state *state,
863 const struct nfs_closeargs *args,
864 const struct nfs_closeres *res,
865 int error
866 ),
867
868 TP_ARGS(state, args, res, error),
869
870 TP_STRUCT__entry(
871 __field(dev_t, dev)
872 __field(u32, fhandle)
873 __field(u64, fileid)
874 __field(unsigned int, fmode)
Chuck Lever96650e22019-06-19 10:33:53 -0400875 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500876 __field(int, stateid_seq)
877 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400878 ),
879
880 TP_fast_assign(
881 const struct inode *inode = state->inode;
882
883 __entry->dev = inode->i_sb->s_dev;
884 __entry->fileid = NFS_FILEID(inode);
885 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
886 __entry->fmode = (__force unsigned int)state->state;
887 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500888 __entry->stateid_seq =
889 be32_to_cpu(args->stateid.seqid);
890 __entry->stateid_hash =
891 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400892 ),
893
894 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400895 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500896 "fhandle=0x%08x openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400897 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400898 show_nfsv4_errors(__entry->error),
899 __entry->fmode ? show_fmode_flags(__entry->fmode) :
900 "closed",
901 MAJOR(__entry->dev), MINOR(__entry->dev),
902 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500903 __entry->fhandle,
904 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400905 )
906);
907
Chuck Lever5b2095d2018-12-19 11:00:11 -0500908TRACE_DEFINE_ENUM(F_GETLK);
909TRACE_DEFINE_ENUM(F_SETLK);
910TRACE_DEFINE_ENUM(F_SETLKW);
911TRACE_DEFINE_ENUM(F_RDLCK);
912TRACE_DEFINE_ENUM(F_WRLCK);
913TRACE_DEFINE_ENUM(F_UNLCK);
914
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400915#define show_lock_cmd(type) \
916 __print_symbolic((int)type, \
917 { F_GETLK, "GETLK" }, \
918 { F_SETLK, "SETLK" }, \
919 { F_SETLKW, "SETLKW" })
920#define show_lock_type(type) \
921 __print_symbolic((int)type, \
922 { F_RDLCK, "RDLCK" }, \
923 { F_WRLCK, "WRLCK" }, \
924 { F_UNLCK, "UNLCK" })
925
926DECLARE_EVENT_CLASS(nfs4_lock_event,
927 TP_PROTO(
928 const struct file_lock *request,
929 const struct nfs4_state *state,
930 int cmd,
931 int error
932 ),
933
934 TP_ARGS(request, state, cmd, error),
935
936 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400937 __field(unsigned long, error)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400938 __field(int, cmd)
939 __field(char, type)
940 __field(loff_t, start)
941 __field(loff_t, end)
942 __field(dev_t, dev)
943 __field(u32, fhandle)
944 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500945 __field(int, stateid_seq)
946 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400947 ),
948
949 TP_fast_assign(
950 const struct inode *inode = state->inode;
951
952 __entry->error = error;
953 __entry->cmd = cmd;
954 __entry->type = request->fl_type;
955 __entry->start = request->fl_start;
956 __entry->end = request->fl_end;
957 __entry->dev = inode->i_sb->s_dev;
958 __entry->fileid = NFS_FILEID(inode);
959 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500960 __entry->stateid_seq =
961 be32_to_cpu(state->stateid.seqid);
962 __entry->stateid_hash =
963 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400964 ),
965
966 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400967 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500968 "fileid=%02x:%02x:%llu fhandle=0x%08x "
969 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400970 -__entry->error,
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400971 show_nfsv4_errors(__entry->error),
972 show_lock_cmd(__entry->cmd),
973 show_lock_type(__entry->type),
974 (long long)__entry->start,
975 (long long)__entry->end,
976 MAJOR(__entry->dev), MINOR(__entry->dev),
977 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500978 __entry->fhandle,
979 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400980 )
981);
982
983#define DEFINE_NFS4_LOCK_EVENT(name) \
984 DEFINE_EVENT(nfs4_lock_event, name, \
985 TP_PROTO( \
986 const struct file_lock *request, \
987 const struct nfs4_state *state, \
988 int cmd, \
989 int error \
990 ), \
991 TP_ARGS(request, state, cmd, error))
992DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400993DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
994
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500995TRACE_EVENT(nfs4_set_lock,
996 TP_PROTO(
997 const struct file_lock *request,
998 const struct nfs4_state *state,
999 const nfs4_stateid *lockstateid,
1000 int cmd,
1001 int error
1002 ),
1003
1004 TP_ARGS(request, state, lockstateid, cmd, error),
1005
1006 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001007 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001008 __field(int, cmd)
1009 __field(char, type)
1010 __field(loff_t, start)
1011 __field(loff_t, end)
1012 __field(dev_t, dev)
1013 __field(u32, fhandle)
1014 __field(u64, fileid)
1015 __field(int, stateid_seq)
1016 __field(u32, stateid_hash)
1017 __field(int, lockstateid_seq)
1018 __field(u32, lockstateid_hash)
1019 ),
1020
1021 TP_fast_assign(
1022 const struct inode *inode = state->inode;
1023
1024 __entry->error = error;
1025 __entry->cmd = cmd;
1026 __entry->type = request->fl_type;
1027 __entry->start = request->fl_start;
1028 __entry->end = request->fl_end;
1029 __entry->dev = inode->i_sb->s_dev;
1030 __entry->fileid = NFS_FILEID(inode);
1031 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1032 __entry->stateid_seq =
1033 be32_to_cpu(state->stateid.seqid);
1034 __entry->stateid_hash =
1035 nfs_stateid_hash(&state->stateid);
1036 __entry->lockstateid_seq =
1037 be32_to_cpu(lockstateid->seqid);
1038 __entry->lockstateid_hash =
1039 nfs_stateid_hash(lockstateid);
1040 ),
1041
1042 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001043 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001044 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1045 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001046 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001047 show_nfsv4_errors(__entry->error),
1048 show_lock_cmd(__entry->cmd),
1049 show_lock_type(__entry->type),
1050 (long long)__entry->start,
1051 (long long)__entry->end,
1052 MAJOR(__entry->dev), MINOR(__entry->dev),
1053 (unsigned long long)__entry->fileid,
1054 __entry->fhandle,
1055 __entry->stateid_seq, __entry->stateid_hash,
1056 __entry->lockstateid_seq, __entry->lockstateid_hash
1057 )
1058);
1059
Chuck Lever21f86d22019-11-05 11:04:13 -05001060TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
1061TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
1062TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
1063TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
1064TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
1065TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
1066TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
1067TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
1068TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
1069TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
1070TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
1071TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
1072TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
1073TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
1074TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
1075
1076#define show_nfs4_state_flags(flags) \
1077 __print_flags(flags, "|", \
1078 { LK_STATE_IN_USE, "IN_USE" }, \
1079 { NFS_DELEGATED_STATE, "DELEGATED" }, \
1080 { NFS_OPEN_STATE, "OPEN" }, \
1081 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
1082 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
1083 { NFS_O_RDWR_STATE, "O_RDWR" }, \
1084 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
1085 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
1086 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
1087 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
1088 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
1089 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
1090 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
1091 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
1092 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
1093
1094#define show_nfs4_lock_flags(flags) \
1095 __print_flags(flags, "|", \
1096 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
1097 { BIT(NFS_LOCK_LOST), "LOST" })
1098
1099TRACE_EVENT(nfs4_state_lock_reclaim,
1100 TP_PROTO(
1101 const struct nfs4_state *state,
1102 const struct nfs4_lock_state *lock
1103 ),
1104
1105 TP_ARGS(state, lock),
1106
1107 TP_STRUCT__entry(
1108 __field(dev_t, dev)
1109 __field(u32, fhandle)
1110 __field(u64, fileid)
1111 __field(unsigned long, state_flags)
1112 __field(unsigned long, lock_flags)
1113 __field(int, stateid_seq)
1114 __field(u32, stateid_hash)
1115 ),
1116
1117 TP_fast_assign(
1118 const struct inode *inode = state->inode;
1119
1120 __entry->dev = inode->i_sb->s_dev;
1121 __entry->fileid = NFS_FILEID(inode);
1122 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1123 __entry->state_flags = state->flags;
1124 __entry->lock_flags = lock->ls_flags;
1125 __entry->stateid_seq =
1126 be32_to_cpu(state->stateid.seqid);
1127 __entry->stateid_hash =
1128 nfs_stateid_hash(&state->stateid);
1129 ),
1130
1131 TP_printk(
1132 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1133 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
1134 MAJOR(__entry->dev), MINOR(__entry->dev),
1135 (unsigned long long)__entry->fileid, __entry->fhandle,
1136 __entry->stateid_seq, __entry->stateid_hash,
1137 show_nfs4_state_flags(__entry->state_flags),
1138 show_nfs4_lock_flags(__entry->lock_flags)
1139 )
1140)
1141
Trond Myklebustca8acf82013-08-13 10:36:56 -04001142DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
1143 TP_PROTO(
1144 const struct inode *inode,
1145 fmode_t fmode
1146 ),
1147
1148 TP_ARGS(inode, fmode),
1149
1150 TP_STRUCT__entry(
1151 __field(dev_t, dev)
1152 __field(u32, fhandle)
1153 __field(u64, fileid)
1154 __field(unsigned int, fmode)
1155 ),
1156
1157 TP_fast_assign(
1158 __entry->dev = inode->i_sb->s_dev;
1159 __entry->fileid = NFS_FILEID(inode);
1160 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1161 __entry->fmode = (__force unsigned int)fmode;
1162 ),
1163
1164 TP_printk(
1165 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
1166 show_fmode_flags(__entry->fmode),
1167 MAJOR(__entry->dev), MINOR(__entry->dev),
1168 (unsigned long long)__entry->fileid,
1169 __entry->fhandle
1170 )
1171);
1172#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
1173 DEFINE_EVENT(nfs4_set_delegation_event, name, \
1174 TP_PROTO( \
1175 const struct inode *inode, \
1176 fmode_t fmode \
1177 ), \
1178 TP_ARGS(inode, fmode))
1179DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
1180DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
1181
1182TRACE_EVENT(nfs4_delegreturn_exit,
1183 TP_PROTO(
1184 const struct nfs4_delegreturnargs *args,
1185 const struct nfs4_delegreturnres *res,
1186 int error
1187 ),
1188
1189 TP_ARGS(args, res, error),
1190
1191 TP_STRUCT__entry(
1192 __field(dev_t, dev)
1193 __field(u32, fhandle)
Chuck Lever96650e22019-06-19 10:33:53 -04001194 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001195 __field(int, stateid_seq)
1196 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -04001197 ),
1198
1199 TP_fast_assign(
1200 __entry->dev = res->server->s_dev;
1201 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
1202 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001203 __entry->stateid_seq =
1204 be32_to_cpu(args->stateid->seqid);
1205 __entry->stateid_hash =
1206 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -04001207 ),
1208
1209 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001210 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001211 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001212 -__entry->error,
Trond Myklebustca8acf82013-08-13 10:36:56 -04001213 show_nfsv4_errors(__entry->error),
1214 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001215 __entry->fhandle,
1216 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -04001217 )
1218);
1219
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001220#ifdef CONFIG_NFS_V4_1
1221DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
1222 TP_PROTO(
1223 const struct nfs4_state *state,
1224 const struct nfs4_lock_state *lsp,
1225 int error
1226 ),
1227
1228 TP_ARGS(state, lsp, error),
1229
1230 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001231 __field(unsigned long, error)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001232 __field(dev_t, dev)
1233 __field(u32, fhandle)
1234 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001235 __field(int, stateid_seq)
1236 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001237 ),
1238
1239 TP_fast_assign(
1240 const struct inode *inode = state->inode;
1241
1242 __entry->error = error;
1243 __entry->dev = inode->i_sb->s_dev;
1244 __entry->fileid = NFS_FILEID(inode);
1245 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001246 __entry->stateid_seq =
1247 be32_to_cpu(state->stateid.seqid);
1248 __entry->stateid_hash =
1249 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001250 ),
1251
1252 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001253 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001254 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001255 -__entry->error,
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001256 show_nfsv4_errors(__entry->error),
1257 MAJOR(__entry->dev), MINOR(__entry->dev),
1258 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001259 __entry->fhandle,
1260 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001261 )
1262);
1263
1264#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1265 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1266 TP_PROTO( \
1267 const struct nfs4_state *state, \
1268 const struct nfs4_lock_state *lsp, \
1269 int error \
1270 ), \
1271 TP_ARGS(state, lsp, error))
1272DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1273DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1274DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1275#endif /* CONFIG_NFS_V4_1 */
1276
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001277DECLARE_EVENT_CLASS(nfs4_lookup_event,
1278 TP_PROTO(
1279 const struct inode *dir,
1280 const struct qstr *name,
1281 int error
1282 ),
1283
1284 TP_ARGS(dir, name, error),
1285
1286 TP_STRUCT__entry(
1287 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001288 __field(unsigned long, error)
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001289 __field(u64, dir)
1290 __string(name, name->name)
1291 ),
1292
1293 TP_fast_assign(
1294 __entry->dev = dir->i_sb->s_dev;
1295 __entry->dir = NFS_FILEID(dir);
Chuck Lever96650e22019-06-19 10:33:53 -04001296 __entry->error = -error;
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001297 __assign_str(name, name->name);
1298 ),
1299
1300 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001301 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1302 -__entry->error,
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001303 show_nfsv4_errors(__entry->error),
1304 MAJOR(__entry->dev), MINOR(__entry->dev),
1305 (unsigned long long)__entry->dir,
1306 __get_str(name)
1307 )
1308);
1309
1310#define DEFINE_NFS4_LOOKUP_EVENT(name) \
1311 DEFINE_EVENT(nfs4_lookup_event, name, \
1312 TP_PROTO( \
1313 const struct inode *dir, \
1314 const struct qstr *name, \
1315 int error \
1316 ), \
1317 TP_ARGS(dir, name, error))
1318
1319DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1320DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1321DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1322DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1323DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1324DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1325DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1326
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001327TRACE_EVENT(nfs4_lookupp,
1328 TP_PROTO(
1329 const struct inode *inode,
1330 int error
1331 ),
1332
1333 TP_ARGS(inode, error),
1334
1335 TP_STRUCT__entry(
1336 __field(dev_t, dev)
1337 __field(u64, ino)
Chuck Lever96650e22019-06-19 10:33:53 -04001338 __field(unsigned long, error)
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001339 ),
1340
1341 TP_fast_assign(
1342 __entry->dev = inode->i_sb->s_dev;
1343 __entry->ino = NFS_FILEID(inode);
1344 __entry->error = error;
1345 ),
1346
1347 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001348 "error=%ld (%s) inode=%02x:%02x:%llu",
1349 -__entry->error,
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001350 show_nfsv4_errors(__entry->error),
1351 MAJOR(__entry->dev), MINOR(__entry->dev),
1352 (unsigned long long)__entry->ino
1353 )
1354);
1355
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001356TRACE_EVENT(nfs4_rename,
1357 TP_PROTO(
1358 const struct inode *olddir,
1359 const struct qstr *oldname,
1360 const struct inode *newdir,
1361 const struct qstr *newname,
1362 int error
1363 ),
1364
1365 TP_ARGS(olddir, oldname, newdir, newname, error),
1366
1367 TP_STRUCT__entry(
1368 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001369 __field(unsigned long, error)
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001370 __field(u64, olddir)
1371 __string(oldname, oldname->name)
1372 __field(u64, newdir)
1373 __string(newname, newname->name)
1374 ),
1375
1376 TP_fast_assign(
1377 __entry->dev = olddir->i_sb->s_dev;
1378 __entry->olddir = NFS_FILEID(olddir);
1379 __entry->newdir = NFS_FILEID(newdir);
1380 __entry->error = error;
1381 __assign_str(oldname, oldname->name);
1382 __assign_str(newname, newname->name);
1383 ),
1384
1385 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001386 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001387 "newname=%02x:%02x:%llu/%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001388 -__entry->error,
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001389 show_nfsv4_errors(__entry->error),
1390 MAJOR(__entry->dev), MINOR(__entry->dev),
1391 (unsigned long long)__entry->olddir,
1392 __get_str(oldname),
1393 MAJOR(__entry->dev), MINOR(__entry->dev),
1394 (unsigned long long)__entry->newdir,
1395 __get_str(newname)
1396 )
1397);
1398
Trond Myklebustc1578b72013-08-12 16:58:42 -04001399DECLARE_EVENT_CLASS(nfs4_inode_event,
1400 TP_PROTO(
1401 const struct inode *inode,
1402 int error
1403 ),
1404
1405 TP_ARGS(inode, error),
1406
1407 TP_STRUCT__entry(
1408 __field(dev_t, dev)
1409 __field(u32, fhandle)
1410 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001411 __field(unsigned long, error)
Trond Myklebustc1578b72013-08-12 16:58:42 -04001412 ),
1413
1414 TP_fast_assign(
1415 __entry->dev = inode->i_sb->s_dev;
1416 __entry->fileid = NFS_FILEID(inode);
1417 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Chuck Lever96650e22019-06-19 10:33:53 -04001418 __entry->error = error < 0 ? -error : 0;
Trond Myklebustc1578b72013-08-12 16:58:42 -04001419 ),
1420
1421 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001422 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1423 -__entry->error,
Trond Myklebustc1578b72013-08-12 16:58:42 -04001424 show_nfsv4_errors(__entry->error),
1425 MAJOR(__entry->dev), MINOR(__entry->dev),
1426 (unsigned long long)__entry->fileid,
1427 __entry->fhandle
1428 )
1429);
1430
1431#define DEFINE_NFS4_INODE_EVENT(name) \
1432 DEFINE_EVENT(nfs4_inode_event, name, \
1433 TP_PROTO( \
1434 const struct inode *inode, \
1435 int error \
1436 ), \
1437 TP_ARGS(inode, error))
1438
Trond Myklebustc1578b72013-08-12 16:58:42 -04001439DEFINE_NFS4_INODE_EVENT(nfs4_access);
1440DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1441DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1442DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1443DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1444#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1445DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1446DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1447#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001448
1449DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1450 TP_PROTO(
1451 const struct inode *inode,
1452 const nfs4_stateid *stateid,
1453 int error
1454 ),
1455
1456 TP_ARGS(inode, stateid, error),
1457
1458 TP_STRUCT__entry(
1459 __field(dev_t, dev)
1460 __field(u32, fhandle)
1461 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001462 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001463 __field(int, stateid_seq)
1464 __field(u32, stateid_hash)
1465 ),
1466
1467 TP_fast_assign(
1468 __entry->dev = inode->i_sb->s_dev;
1469 __entry->fileid = NFS_FILEID(inode);
1470 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1471 __entry->error = error;
1472 __entry->stateid_seq =
1473 be32_to_cpu(stateid->seqid);
1474 __entry->stateid_hash =
1475 nfs_stateid_hash(stateid);
1476 ),
1477
1478 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001479 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001480 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001481 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001482 show_nfsv4_errors(__entry->error),
1483 MAJOR(__entry->dev), MINOR(__entry->dev),
1484 (unsigned long long)__entry->fileid,
1485 __entry->fhandle,
1486 __entry->stateid_seq, __entry->stateid_hash
1487 )
1488);
1489
1490#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1491 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1492 TP_PROTO( \
1493 const struct inode *inode, \
1494 const nfs4_stateid *stateid, \
1495 int error \
1496 ), \
1497 TP_ARGS(inode, stateid, error))
1498
1499DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1500DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustad9e02d2017-11-06 15:28:02 -05001501DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1502DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001503
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001504DECLARE_EVENT_CLASS(nfs4_getattr_event,
1505 TP_PROTO(
1506 const struct nfs_server *server,
1507 const struct nfs_fh *fhandle,
1508 const struct nfs_fattr *fattr,
1509 int error
1510 ),
1511
1512 TP_ARGS(server, fhandle, fattr, error),
1513
1514 TP_STRUCT__entry(
1515 __field(dev_t, dev)
1516 __field(u32, fhandle)
1517 __field(u64, fileid)
1518 __field(unsigned int, valid)
Chuck Lever96650e22019-06-19 10:33:53 -04001519 __field(unsigned long, error)
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001520 ),
1521
1522 TP_fast_assign(
1523 __entry->dev = server->s_dev;
1524 __entry->valid = fattr->valid;
1525 __entry->fhandle = nfs_fhandle_hash(fhandle);
1526 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1527 __entry->error = error;
1528 ),
1529
1530 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001531 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001532 "valid=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001533 -__entry->error,
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001534 show_nfsv4_errors(__entry->error),
1535 MAJOR(__entry->dev), MINOR(__entry->dev),
1536 (unsigned long long)__entry->fileid,
1537 __entry->fhandle,
1538 show_nfs_fattr_flags(__entry->valid)
1539 )
1540);
1541
1542#define DEFINE_NFS4_GETATTR_EVENT(name) \
1543 DEFINE_EVENT(nfs4_getattr_event, name, \
1544 TP_PROTO( \
1545 const struct nfs_server *server, \
1546 const struct nfs_fh *fhandle, \
1547 const struct nfs_fattr *fattr, \
1548 int error \
1549 ), \
1550 TP_ARGS(server, fhandle, fattr, error))
1551DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1552DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1553DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1554
Trond Myklebust7cd14862015-08-20 20:07:54 -05001555DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1556 TP_PROTO(
1557 const struct nfs_client *clp,
1558 const struct nfs_fh *fhandle,
1559 const struct inode *inode,
1560 int error
1561 ),
1562
1563 TP_ARGS(clp, fhandle, inode, error),
1564
1565 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001566 __field(unsigned long, error)
Trond Myklebust7cd14862015-08-20 20:07:54 -05001567 __field(dev_t, dev)
1568 __field(u32, fhandle)
1569 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001570 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001571 ),
1572
1573 TP_fast_assign(
1574 __entry->error = error;
1575 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2edaead2018-09-05 14:07:13 -04001576 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebust7cd14862015-08-20 20:07:54 -05001577 __entry->fileid = NFS_FILEID(inode);
1578 __entry->dev = inode->i_sb->s_dev;
1579 } else {
1580 __entry->fileid = 0;
1581 __entry->dev = 0;
1582 }
Anna Schumaker39443692017-11-01 15:48:43 -04001583 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001584 ),
1585
1586 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001587 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7cd14862015-08-20 20:07:54 -05001588 "dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001589 -__entry->error,
Trond Myklebust7cd14862015-08-20 20:07:54 -05001590 show_nfsv4_errors(__entry->error),
1591 MAJOR(__entry->dev), MINOR(__entry->dev),
1592 (unsigned long long)__entry->fileid,
1593 __entry->fhandle,
1594 __get_str(dstaddr)
1595 )
1596);
1597
1598#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1599 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1600 TP_PROTO( \
1601 const struct nfs_client *clp, \
1602 const struct nfs_fh *fhandle, \
1603 const struct inode *inode, \
1604 int error \
1605 ), \
1606 TP_ARGS(clp, fhandle, inode, error))
1607DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1608
Trond Myklebuste07db902015-12-28 14:07:23 -05001609DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1610 TP_PROTO(
1611 const struct nfs_client *clp,
1612 const struct nfs_fh *fhandle,
1613 const struct inode *inode,
1614 const nfs4_stateid *stateid,
1615 int error
1616 ),
1617
1618 TP_ARGS(clp, fhandle, inode, stateid, error),
1619
1620 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001621 __field(unsigned long, error)
Trond Myklebuste07db902015-12-28 14:07:23 -05001622 __field(dev_t, dev)
1623 __field(u32, fhandle)
1624 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001625 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001626 __field(int, stateid_seq)
1627 __field(u32, stateid_hash)
1628 ),
1629
1630 TP_fast_assign(
1631 __entry->error = error;
1632 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2a534a72018-08-23 11:02:49 -04001633 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebuste07db902015-12-28 14:07:23 -05001634 __entry->fileid = NFS_FILEID(inode);
1635 __entry->dev = inode->i_sb->s_dev;
1636 } else {
1637 __entry->fileid = 0;
1638 __entry->dev = 0;
1639 }
Anna Schumaker39443692017-11-01 15:48:43 -04001640 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001641 __entry->stateid_seq =
1642 be32_to_cpu(stateid->seqid);
1643 __entry->stateid_hash =
1644 nfs_stateid_hash(stateid);
1645 ),
1646
1647 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001648 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebuste07db902015-12-28 14:07:23 -05001649 "stateid=%d:0x%08x dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001650 -__entry->error,
Trond Myklebuste07db902015-12-28 14:07:23 -05001651 show_nfsv4_errors(__entry->error),
1652 MAJOR(__entry->dev), MINOR(__entry->dev),
1653 (unsigned long long)__entry->fileid,
1654 __entry->fhandle,
1655 __entry->stateid_seq, __entry->stateid_hash,
1656 __get_str(dstaddr)
1657 )
1658);
1659
1660#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1661 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1662 TP_PROTO( \
1663 const struct nfs_client *clp, \
1664 const struct nfs_fh *fhandle, \
1665 const struct inode *inode, \
1666 const nfs4_stateid *stateid, \
1667 int error \
1668 ), \
1669 TP_ARGS(clp, fhandle, inode, stateid, error))
1670DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1671DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001672
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001673DECLARE_EVENT_CLASS(nfs4_idmap_event,
1674 TP_PROTO(
1675 const char *name,
1676 int len,
1677 u32 id,
1678 int error
1679 ),
1680
1681 TP_ARGS(name, len, id, error),
1682
1683 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001684 __field(unsigned long, error)
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001685 __field(u32, id)
1686 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1687 ),
1688
1689 TP_fast_assign(
1690 if (len < 0)
1691 len = 0;
1692 __entry->error = error < 0 ? error : 0;
1693 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001694 memcpy(__get_str(name), name, len);
1695 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001696 ),
1697
1698 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001699 "error=%ld (%s) id=%u name=%s",
1700 -__entry->error, show_nfsv4_errors(__entry->error),
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001701 __entry->id,
1702 __get_str(name)
1703 )
1704);
1705#define DEFINE_NFS4_IDMAP_EVENT(name) \
1706 DEFINE_EVENT(nfs4_idmap_event, name, \
1707 TP_PROTO( \
1708 const char *name, \
1709 int len, \
1710 u32 id, \
1711 int error \
1712 ), \
1713 TP_ARGS(name, len, id, error))
1714DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1715DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1716DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1717DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1718
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001719DECLARE_EVENT_CLASS(nfs4_read_event,
1720 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001721 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001722 int error
1723 ),
1724
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001725 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001726
1727 TP_STRUCT__entry(
1728 __field(dev_t, dev)
1729 __field(u32, fhandle)
1730 __field(u64, fileid)
1731 __field(loff_t, offset)
1732 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001733 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001734 __field(int, stateid_seq)
1735 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001736 ),
1737
1738 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001739 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001740 const struct nfs4_state *state =
1741 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001742 __entry->dev = inode->i_sb->s_dev;
1743 __entry->fileid = NFS_FILEID(inode);
1744 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001745 __entry->offset = hdr->args.offset;
1746 __entry->count = hdr->args.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001747 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001748 __entry->stateid_seq =
1749 be32_to_cpu(state->stateid.seqid);
1750 __entry->stateid_hash =
1751 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001752 ),
1753
1754 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001755 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001756 "offset=%lld count=%zu stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001757 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001758 show_nfsv4_errors(__entry->error),
1759 MAJOR(__entry->dev), MINOR(__entry->dev),
1760 (unsigned long long)__entry->fileid,
1761 __entry->fhandle,
1762 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001763 __entry->count,
1764 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001765 )
1766);
1767#define DEFINE_NFS4_READ_EVENT(name) \
1768 DEFINE_EVENT(nfs4_read_event, name, \
1769 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001770 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001771 int error \
1772 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001773 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001774DEFINE_NFS4_READ_EVENT(nfs4_read);
1775#ifdef CONFIG_NFS_V4_1
1776DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1777#endif /* CONFIG_NFS_V4_1 */
1778
1779DECLARE_EVENT_CLASS(nfs4_write_event,
1780 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001781 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001782 int error
1783 ),
1784
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001785 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001786
1787 TP_STRUCT__entry(
1788 __field(dev_t, dev)
1789 __field(u32, fhandle)
1790 __field(u64, fileid)
1791 __field(loff_t, offset)
1792 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001793 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001794 __field(int, stateid_seq)
1795 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001796 ),
1797
1798 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001799 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001800 const struct nfs4_state *state =
1801 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001802 __entry->dev = inode->i_sb->s_dev;
1803 __entry->fileid = NFS_FILEID(inode);
1804 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001805 __entry->offset = hdr->args.offset;
1806 __entry->count = hdr->args.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001807 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001808 __entry->stateid_seq =
1809 be32_to_cpu(state->stateid.seqid);
1810 __entry->stateid_hash =
1811 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001812 ),
1813
1814 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001815 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001816 "offset=%lld count=%zu stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001817 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001818 show_nfsv4_errors(__entry->error),
1819 MAJOR(__entry->dev), MINOR(__entry->dev),
1820 (unsigned long long)__entry->fileid,
1821 __entry->fhandle,
1822 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001823 __entry->count,
1824 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001825 )
1826);
1827
1828#define DEFINE_NFS4_WRITE_EVENT(name) \
1829 DEFINE_EVENT(nfs4_write_event, name, \
1830 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001831 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001832 int error \
1833 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001834 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001835DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1836#ifdef CONFIG_NFS_V4_1
1837DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1838#endif /* CONFIG_NFS_V4_1 */
1839
1840DECLARE_EVENT_CLASS(nfs4_commit_event,
1841 TP_PROTO(
1842 const struct nfs_commit_data *data,
1843 int error
1844 ),
1845
1846 TP_ARGS(data, error),
1847
1848 TP_STRUCT__entry(
1849 __field(dev_t, dev)
1850 __field(u32, fhandle)
1851 __field(u64, fileid)
1852 __field(loff_t, offset)
1853 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001854 __field(unsigned long, error)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001855 ),
1856
1857 TP_fast_assign(
1858 const struct inode *inode = data->inode;
1859 __entry->dev = inode->i_sb->s_dev;
1860 __entry->fileid = NFS_FILEID(inode);
1861 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1862 __entry->offset = data->args.offset;
1863 __entry->count = data->args.count;
1864 __entry->error = error;
1865 ),
1866
1867 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001868 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001869 "offset=%lld count=%zu",
Chuck Lever96650e22019-06-19 10:33:53 -04001870 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001871 show_nfsv4_errors(__entry->error),
1872 MAJOR(__entry->dev), MINOR(__entry->dev),
1873 (unsigned long long)__entry->fileid,
1874 __entry->fhandle,
1875 (long long)__entry->offset,
1876 __entry->count
1877 )
1878);
1879#define DEFINE_NFS4_COMMIT_EVENT(name) \
1880 DEFINE_EVENT(nfs4_commit_event, name, \
1881 TP_PROTO( \
1882 const struct nfs_commit_data *data, \
1883 int error \
1884 ), \
1885 TP_ARGS(data, error))
1886DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1887#ifdef CONFIG_NFS_V4_1
1888DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001889
Chuck Lever5b2095d2018-12-19 11:00:11 -05001890TRACE_DEFINE_ENUM(IOMODE_READ);
1891TRACE_DEFINE_ENUM(IOMODE_RW);
1892TRACE_DEFINE_ENUM(IOMODE_ANY);
1893
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001894#define show_pnfs_iomode(iomode) \
1895 __print_symbolic(iomode, \
1896 { IOMODE_READ, "READ" }, \
1897 { IOMODE_RW, "RW" }, \
1898 { IOMODE_ANY, "ANY" })
1899
1900TRACE_EVENT(nfs4_layoutget,
1901 TP_PROTO(
1902 const struct nfs_open_context *ctx,
1903 const struct pnfs_layout_range *args,
1904 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001905 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001906 int error
1907 ),
1908
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001909 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001910
1911 TP_STRUCT__entry(
1912 __field(dev_t, dev)
1913 __field(u32, fhandle)
1914 __field(u64, fileid)
1915 __field(u32, iomode)
1916 __field(u64, offset)
1917 __field(u64, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001918 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001919 __field(int, stateid_seq)
1920 __field(u32, stateid_hash)
1921 __field(int, layoutstateid_seq)
1922 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001923 ),
1924
1925 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001926 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001927 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001928 __entry->dev = inode->i_sb->s_dev;
1929 __entry->fileid = NFS_FILEID(inode);
1930 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1931 __entry->iomode = args->iomode;
1932 __entry->offset = args->offset;
1933 __entry->count = args->length;
1934 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001935 __entry->stateid_seq =
1936 be32_to_cpu(state->stateid.seqid);
1937 __entry->stateid_hash =
1938 nfs_stateid_hash(&state->stateid);
1939 if (!error) {
1940 __entry->layoutstateid_seq =
1941 be32_to_cpu(layout_stateid->seqid);
1942 __entry->layoutstateid_hash =
1943 nfs_stateid_hash(layout_stateid);
1944 } else {
1945 __entry->layoutstateid_seq = 0;
1946 __entry->layoutstateid_hash = 0;
1947 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001948 ),
1949
1950 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001951 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001952 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1953 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001954 -__entry->error,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001955 show_nfsv4_errors(__entry->error),
1956 MAJOR(__entry->dev), MINOR(__entry->dev),
1957 (unsigned long long)__entry->fileid,
1958 __entry->fhandle,
1959 show_pnfs_iomode(__entry->iomode),
1960 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001961 (unsigned long long)__entry->count,
1962 __entry->stateid_seq, __entry->stateid_hash,
1963 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001964 )
1965);
1966
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001967DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1968DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebust6a463beb2015-08-20 15:40:47 -05001969DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001970
Chuck Lever5b2095d2018-12-19 11:00:11 -05001971TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
1972TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
1973TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
1974TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
1975TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
1976TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
1977TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
1978TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
1979TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
1980TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
1981TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
1982TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
1983TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
Trond Myklebustd5b92162019-07-18 09:32:17 -04001984TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
Chuck Lever5b2095d2018-12-19 11:00:11 -05001985
Jeff Layton9a4bf312015-12-10 10:41:58 -05001986#define show_pnfs_update_layout_reason(reason) \
1987 __print_symbolic(reason, \
1988 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1989 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1990 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1991 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1992 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1993 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1994 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1995 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1996 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1997 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04001998 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1999 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Trond Myklebustd5b92162019-07-18 09:32:17 -04002000 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
2001 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
Jeff Layton9a4bf312015-12-10 10:41:58 -05002002
2003TRACE_EVENT(pnfs_update_layout,
2004 TP_PROTO(struct inode *inode,
2005 loff_t pos,
2006 u64 count,
2007 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05002008 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04002009 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002010 enum pnfs_update_layout_reason reason
2011 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04002012 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05002013 TP_STRUCT__entry(
2014 __field(dev_t, dev)
2015 __field(u64, fileid)
2016 __field(u32, fhandle)
2017 __field(loff_t, pos)
2018 __field(u64, count)
2019 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05002020 __field(int, layoutstateid_seq)
2021 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04002022 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05002023 __field(enum pnfs_update_layout_reason, reason)
2024 ),
2025 TP_fast_assign(
2026 __entry->dev = inode->i_sb->s_dev;
2027 __entry->fileid = NFS_FILEID(inode);
2028 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2029 __entry->pos = pos;
2030 __entry->count = count;
2031 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002032 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05002033 if (lo != NULL) {
2034 __entry->layoutstateid_seq =
2035 be32_to_cpu(lo->plh_stateid.seqid);
2036 __entry->layoutstateid_hash =
2037 nfs_stateid_hash(&lo->plh_stateid);
2038 } else {
2039 __entry->layoutstateid_seq = 0;
2040 __entry->layoutstateid_hash = 0;
2041 }
Jeff Layton183d9e72016-05-17 12:28:47 -04002042 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002043 ),
2044 TP_printk(
2045 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05002046 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04002047 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05002048 MAJOR(__entry->dev), MINOR(__entry->dev),
2049 (unsigned long long)__entry->fileid,
2050 __entry->fhandle,
2051 show_pnfs_iomode(__entry->iomode),
2052 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05002053 (unsigned long long)__entry->count,
2054 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04002055 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002056 show_pnfs_update_layout_reason(__entry->reason)
2057 )
2058);
2059
Trond Myklebustd5b92162019-07-18 09:32:17 -04002060DECLARE_EVENT_CLASS(pnfs_layout_event,
2061 TP_PROTO(struct inode *inode,
2062 loff_t pos,
2063 u64 count,
2064 enum pnfs_iomode iomode,
2065 struct pnfs_layout_hdr *lo,
2066 struct pnfs_layout_segment *lseg
2067 ),
2068 TP_ARGS(inode, pos, count, iomode, lo, lseg),
2069 TP_STRUCT__entry(
2070 __field(dev_t, dev)
2071 __field(u64, fileid)
2072 __field(u32, fhandle)
2073 __field(loff_t, pos)
2074 __field(u64, count)
2075 __field(enum pnfs_iomode, iomode)
2076 __field(int, layoutstateid_seq)
2077 __field(u32, layoutstateid_hash)
2078 __field(long, lseg)
2079 ),
2080 TP_fast_assign(
2081 __entry->dev = inode->i_sb->s_dev;
2082 __entry->fileid = NFS_FILEID(inode);
2083 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2084 __entry->pos = pos;
2085 __entry->count = count;
2086 __entry->iomode = iomode;
2087 if (lo != NULL) {
2088 __entry->layoutstateid_seq =
2089 be32_to_cpu(lo->plh_stateid.seqid);
2090 __entry->layoutstateid_hash =
2091 nfs_stateid_hash(&lo->plh_stateid);
2092 } else {
2093 __entry->layoutstateid_seq = 0;
2094 __entry->layoutstateid_hash = 0;
2095 }
2096 __entry->lseg = (long)lseg;
2097 ),
2098 TP_printk(
2099 "fileid=%02x:%02x:%llu fhandle=0x%08x "
2100 "iomode=%s pos=%llu count=%llu "
2101 "layoutstateid=%d:0x%08x lseg=0x%lx",
2102 MAJOR(__entry->dev), MINOR(__entry->dev),
2103 (unsigned long long)__entry->fileid,
2104 __entry->fhandle,
2105 show_pnfs_iomode(__entry->iomode),
2106 (unsigned long long)__entry->pos,
2107 (unsigned long long)__entry->count,
2108 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
2109 __entry->lseg
2110 )
2111);
2112
2113#define DEFINE_PNFS_LAYOUT_EVENT(name) \
2114 DEFINE_EVENT(pnfs_layout_event, name, \
2115 TP_PROTO(struct inode *inode, \
2116 loff_t pos, \
2117 u64 count, \
2118 enum pnfs_iomode iomode, \
2119 struct pnfs_layout_hdr *lo, \
2120 struct pnfs_layout_segment *lseg \
2121 ), \
2122 TP_ARGS(inode, pos, count, iomode, lo, lseg))
2123
2124DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
2125DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
2126DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
2127DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
2128DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
2129DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
2130DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
2131
Trond Myklebustcc668ab2013-08-14 15:31:28 -04002132#endif /* CONFIG_NFS_V4_1 */
2133
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002134#endif /* _TRACE_NFS4_H */
2135
2136#undef TRACE_INCLUDE_PATH
2137#define TRACE_INCLUDE_PATH .
2138#define TRACE_INCLUDE_FILE nfs4trace
2139/* This part must be outside protection */
2140#include <trace/define_trace.h>