blob: 2ef75caad6dabfaa7c62ae6e72faf1751286931d [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 Myklebust0722dc92020-01-06 15:25:07 -0500158TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_MDS);
159TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_PNFS);
160
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400161#define show_nfsv4_errors(error) \
Chuck Lever96650e22019-06-19 10:33:53 -0400162 __print_symbolic(error, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400163 { NFS4_OK, "OK" }, \
164 /* Mapped by nfs4_stat_to_errno() */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500165 { EPERM, "EPERM" }, \
166 { ENOENT, "ENOENT" }, \
167 { EIO, "EIO" }, \
168 { ENXIO, "ENXIO" }, \
169 { EACCES, "EACCES" }, \
170 { EEXIST, "EEXIST" }, \
171 { EXDEV, "EXDEV" }, \
172 { ENOTDIR, "ENOTDIR" }, \
173 { EISDIR, "EISDIR" }, \
174 { EFBIG, "EFBIG" }, \
175 { ENOSPC, "ENOSPC" }, \
176 { EROFS, "EROFS" }, \
177 { EMLINK, "EMLINK" }, \
178 { ENAMETOOLONG, "ENAMETOOLONG" }, \
179 { ENOTEMPTY, "ENOTEMPTY" }, \
180 { EDQUOT, "EDQUOT" }, \
181 { ESTALE, "ESTALE" }, \
182 { EBADHANDLE, "EBADHANDLE" }, \
183 { EBADCOOKIE, "EBADCOOKIE" }, \
184 { ENOTSUPP, "ENOTSUPP" }, \
185 { ETOOSMALL, "ETOOSMALL" }, \
186 { EREMOTEIO, "EREMOTEIO" }, \
187 { EBADTYPE, "EBADTYPE" }, \
188 { EAGAIN, "EAGAIN" }, \
189 { ELOOP, "ELOOP" }, \
190 { EOPNOTSUPP, "EOPNOTSUPP" }, \
191 { EDEADLK, "EDEADLK" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400192 /* RPC errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500193 { ENOMEM, "ENOMEM" }, \
194 { EKEYEXPIRED, "EKEYEXPIRED" }, \
195 { ETIMEDOUT, "ETIMEDOUT" }, \
196 { ERESTARTSYS, "ERESTARTSYS" }, \
197 { ECONNREFUSED, "ECONNREFUSED" }, \
198 { ECONNRESET, "ECONNRESET" }, \
199 { ENETUNREACH, "ENETUNREACH" }, \
200 { EHOSTUNREACH, "EHOSTUNREACH" }, \
201 { EHOSTDOWN, "EHOSTDOWN" }, \
202 { EPIPE, "EPIPE" }, \
203 { EPFNOSUPPORT, "EPFNOSUPPORT" }, \
204 { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400205 /* NFSv4 native errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500206 { NFS4ERR_ACCESS, "ACCESS" }, \
207 { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
208 { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
209 { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
210 { NFS4ERR_BADCHAR, "BADCHAR" }, \
211 { NFS4ERR_BADHANDLE, "BADHANDLE" }, \
212 { NFS4ERR_BADIOMODE, "BADIOMODE" }, \
213 { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
214 { NFS4ERR_BADLABEL, "BADLABEL" }, \
215 { NFS4ERR_BADNAME, "BADNAME" }, \
216 { NFS4ERR_BADOWNER, "BADOWNER" }, \
217 { NFS4ERR_BADSESSION, "BADSESSION" }, \
218 { NFS4ERR_BADSLOT, "BADSLOT" }, \
219 { NFS4ERR_BADTYPE, "BADTYPE" }, \
220 { NFS4ERR_BADXDR, "BADXDR" }, \
221 { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
222 { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
223 { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
224 { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
225 { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
226 { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
227 { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
228 { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
229 { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
230 { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
231 { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400232 "CONN_NOT_BOUND_TO_SESSION" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500233 { NFS4ERR_DEADLOCK, "DEADLOCK" }, \
234 { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
235 { NFS4ERR_DELAY, "DELAY" }, \
236 { NFS4ERR_DELEG_ALREADY_WANTED, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400237 "DELEG_ALREADY_WANTED" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500238 { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
239 { NFS4ERR_DENIED, "DENIED" }, \
240 { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
241 { NFS4ERR_DQUOT, "DQUOT" }, \
242 { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
243 { NFS4ERR_EXIST, "EXIST" }, \
244 { NFS4ERR_EXPIRED, "EXPIRED" }, \
245 { NFS4ERR_FBIG, "FBIG" }, \
246 { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
247 { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
248 { NFS4ERR_GRACE, "GRACE" }, \
249 { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
250 { NFS4ERR_INVAL, "INVAL" }, \
251 { NFS4ERR_IO, "IO" }, \
252 { NFS4ERR_ISDIR, "ISDIR" }, \
253 { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
254 { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
255 { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
256 { NFS4ERR_LOCKED, "LOCKED" }, \
257 { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
258 { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
259 { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
260 { NFS4ERR_MLINK, "MLINK" }, \
261 { NFS4ERR_MOVED, "MOVED" }, \
262 { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
263 { NFS4ERR_NOENT, "NOENT" }, \
264 { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
265 { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
266 { NFS4ERR_NOSPC, "NOSPC" }, \
267 { NFS4ERR_NOTDIR, "NOTDIR" }, \
268 { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
269 { NFS4ERR_NOTSUPP, "NOTSUPP" }, \
270 { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
271 { NFS4ERR_NOT_SAME, "NOT_SAME" }, \
272 { NFS4ERR_NO_GRACE, "NO_GRACE" }, \
273 { NFS4ERR_NXIO, "NXIO" }, \
274 { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
275 { NFS4ERR_OPENMODE, "OPENMODE" }, \
276 { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
277 { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
278 { NFS4ERR_PERM, "PERM" }, \
279 { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
280 { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
281 { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
282 { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
283 { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
284 { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
285 { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
286 { NFS4ERR_REP_TOO_BIG_TO_CACHE, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400287 "REP_TOO_BIG_TO_CACHE" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500288 { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
289 { NFS4ERR_RESOURCE, "RESOURCE" }, \
290 { NFS4ERR_RESTOREFH, "RESTOREFH" }, \
291 { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
292 { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
293 { NFS4ERR_ROFS, "ROFS" }, \
294 { NFS4ERR_SAME, "SAME" }, \
295 { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
296 { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
297 { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
298 { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
299 { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
300 { NFS4ERR_STALE, "STALE" }, \
301 { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
302 { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
303 { NFS4ERR_SYMLINK, "SYMLINK" }, \
304 { NFS4ERR_TOOSMALL, "TOOSMALL" }, \
305 { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
306 { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
307 { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
308 { NFS4ERR_WRONGSEC, "WRONGSEC" }, \
309 { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
310 { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
Trond Myklebust0722dc92020-01-06 15:25:07 -0500311 { NFS4ERR_XDEV, "XDEV" }, \
312 /* ***** Internal to Linux NFS client ***** */ \
313 { NFS4ERR_RESET_TO_MDS, "RESET_TO_MDS" }, \
314 { NFS4ERR_RESET_TO_PNFS, "RESET_TO_PNFS" })
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400315
Trond Myklebust42113a72013-08-12 16:19:27 -0400316#define show_open_flags(flags) \
317 __print_flags(flags, "|", \
318 { O_CREAT, "O_CREAT" }, \
319 { O_EXCL, "O_EXCL" }, \
320 { O_TRUNC, "O_TRUNC" }, \
321 { O_DIRECT, "O_DIRECT" })
322
323#define show_fmode_flags(mode) \
324 __print_flags(mode, "|", \
325 { ((__force unsigned long)FMODE_READ), "READ" }, \
326 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
327 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
328
Trond Myklebustb5f875a2013-08-13 13:01:39 -0400329#define show_nfs_fattr_flags(valid) \
330 __print_flags((unsigned long)valid, "|", \
331 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
332 { NFS_ATTR_FATTR_MODE, "MODE" }, \
333 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
334 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
335 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
336 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
337 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
338 { NFS_ATTR_FATTR_FSID, "FSID" }, \
339 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
340 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
341 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
342 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
343 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
344 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
345 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
346
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400347DECLARE_EVENT_CLASS(nfs4_clientid_event,
348 TP_PROTO(
349 const struct nfs_client *clp,
350 int error
351 ),
352
353 TP_ARGS(clp, error),
354
355 TP_STRUCT__entry(
Anna Schumaker39443692017-11-01 15:48:43 -0400356 __string(dstaddr, clp->cl_hostname)
Chuck Lever96650e22019-06-19 10:33:53 -0400357 __field(unsigned long, error)
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400358 ),
359
360 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -0500361 __entry->error = error < 0 ? -error : 0;
Anna Schumaker39443692017-11-01 15:48:43 -0400362 __assign_str(dstaddr, clp->cl_hostname);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400363 ),
364
365 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400366 "error=%ld (%s) dstaddr=%s",
367 -__entry->error,
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400368 show_nfsv4_errors(__entry->error),
369 __get_str(dstaddr)
370 )
371);
372#define DEFINE_NFS4_CLIENTID_EVENT(name) \
373 DEFINE_EVENT(nfs4_clientid_event, name, \
374 TP_PROTO( \
375 const struct nfs_client *clp, \
376 int error \
377 ), \
378 TP_ARGS(clp, error))
379DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
380DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
381DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
382DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
383#ifdef CONFIG_NFS_V4_1
384DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
385DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
386DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
387DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
388DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
389DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
390DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400391
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400392#define show_nfs4_sequence_status_flags(status) \
393 __print_flags((unsigned long)status, "|", \
394 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
395 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
396 "CB_GSS_CONTEXTS_EXPIRING" }, \
397 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
398 "CB_GSS_CONTEXTS_EXPIRED" }, \
399 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
400 "EXPIRED_ALL_STATE_REVOKED" }, \
401 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
402 "EXPIRED_SOME_STATE_REVOKED" }, \
403 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
404 "ADMIN_STATE_REVOKED" }, \
405 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
406 "RECALLABLE_STATE_REVOKED" }, \
407 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
408 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
409 "RESTART_RECLAIM_NEEDED" }, \
410 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
411 "CB_PATH_DOWN_SESSION" }, \
412 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
413 "BACKCHANNEL_FAULT" })
414
415TRACE_EVENT(nfs4_sequence_done,
416 TP_PROTO(
417 const struct nfs4_session *session,
418 const struct nfs4_sequence_res *res
419 ),
420 TP_ARGS(session, res),
421
422 TP_STRUCT__entry(
423 __field(unsigned int, session)
424 __field(unsigned int, slot_nr)
425 __field(unsigned int, seq_nr)
426 __field(unsigned int, highest_slotid)
427 __field(unsigned int, target_highest_slotid)
428 __field(unsigned int, status_flags)
Chuck Lever96650e22019-06-19 10:33:53 -0400429 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400430 ),
431
432 TP_fast_assign(
433 const struct nfs4_slot *sr_slot = res->sr_slot;
434 __entry->session = nfs_session_id_hash(&session->sess_id);
435 __entry->slot_nr = sr_slot->slot_nr;
436 __entry->seq_nr = sr_slot->seq_nr;
437 __entry->highest_slotid = res->sr_highest_slotid;
438 __entry->target_highest_slotid =
439 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500440 __entry->status_flags = res->sr_status_flags;
Trond Myklebust118b6292020-01-06 15:25:06 -0500441 __entry->error = res->sr_status < 0 ?
442 -res->sr_status : 0;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400443 ),
444 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400445 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400446 "highest_slotid=%u target_highest_slotid=%u "
447 "status_flags=%u (%s)",
Chuck Lever96650e22019-06-19 10:33:53 -0400448 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400449 show_nfsv4_errors(__entry->error),
450 __entry->session,
451 __entry->slot_nr,
452 __entry->seq_nr,
453 __entry->highest_slotid,
454 __entry->target_highest_slotid,
455 __entry->status_flags,
456 show_nfs4_sequence_status_flags(__entry->status_flags)
457 )
458);
459
460struct cb_sequenceargs;
461struct cb_sequenceres;
462
463TRACE_EVENT(nfs4_cb_sequence,
464 TP_PROTO(
465 const struct cb_sequenceargs *args,
466 const struct cb_sequenceres *res,
467 __be32 status
468 ),
469 TP_ARGS(args, res, status),
470
471 TP_STRUCT__entry(
472 __field(unsigned int, session)
473 __field(unsigned int, slot_nr)
474 __field(unsigned int, seq_nr)
475 __field(unsigned int, highest_slotid)
476 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400477 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400478 ),
479
480 TP_fast_assign(
481 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
482 __entry->slot_nr = args->csa_slotid;
483 __entry->seq_nr = args->csa_sequenceid;
484 __entry->highest_slotid = args->csa_highestslotid;
485 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400486 __entry->error = be32_to_cpu(status);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400487 ),
488
489 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400490 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400491 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400492 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400493 show_nfsv4_errors(__entry->error),
494 __entry->session,
495 __entry->slot_nr,
496 __entry->seq_nr,
497 __entry->highest_slotid
498 )
499);
Chuck Leverc5833f02019-06-19 10:33:47 -0400500
501TRACE_EVENT(nfs4_cb_seqid_err,
502 TP_PROTO(
503 const struct cb_sequenceargs *args,
504 __be32 status
505 ),
506 TP_ARGS(args, status),
507
508 TP_STRUCT__entry(
509 __field(unsigned int, session)
510 __field(unsigned int, slot_nr)
511 __field(unsigned int, seq_nr)
512 __field(unsigned int, highest_slotid)
513 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400514 __field(unsigned long, error)
Chuck Leverc5833f02019-06-19 10:33:47 -0400515 ),
516
517 TP_fast_assign(
518 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
519 __entry->slot_nr = args->csa_slotid;
520 __entry->seq_nr = args->csa_sequenceid;
521 __entry->highest_slotid = args->csa_highestslotid;
522 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400523 __entry->error = be32_to_cpu(status);
Chuck Leverc5833f02019-06-19 10:33:47 -0400524 ),
525
526 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400527 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Chuck Leverc5833f02019-06-19 10:33:47 -0400528 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400529 -__entry->error,
Chuck Leverc5833f02019-06-19 10:33:47 -0400530 show_nfsv4_errors(__entry->error),
531 __entry->session,
532 __entry->slot_nr,
533 __entry->seq_nr,
534 __entry->highest_slotid
535 )
536);
537
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400538#endif /* CONFIG_NFS_V4_1 */
539
Anna Schumakerad05cc02017-01-11 13:37:06 -0500540TRACE_EVENT(nfs4_setup_sequence,
541 TP_PROTO(
542 const struct nfs4_session *session,
543 const struct nfs4_sequence_args *args
544 ),
545 TP_ARGS(session, args),
546
547 TP_STRUCT__entry(
548 __field(unsigned int, session)
549 __field(unsigned int, slot_nr)
550 __field(unsigned int, seq_nr)
551 __field(unsigned int, highest_used_slotid)
552 ),
553
554 TP_fast_assign(
555 const struct nfs4_slot *sa_slot = args->sa_slot;
556 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
557 __entry->slot_nr = sa_slot->slot_nr;
558 __entry->seq_nr = sa_slot->seq_nr;
559 __entry->highest_used_slotid =
560 sa_slot->table->highest_used_slotid;
561 ),
562 TP_printk(
563 "session=0x%08x slot_nr=%u seq_nr=%u "
564 "highest_used_slotid=%u",
565 __entry->session,
566 __entry->slot_nr,
567 __entry->seq_nr,
568 __entry->highest_used_slotid
569 )
570);
571
Chuck Lever511ba522019-11-05 11:04:07 -0500572TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
573TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
574TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
575TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
576TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
577TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
578TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
579TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
580TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
581TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
582TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
583TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
584TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
585TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
586TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
Trond Myklebustb5fdf842020-02-18 15:58:31 -0500587TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_RUNNING);
588TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ);
589TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW);
Chuck Lever511ba522019-11-05 11:04:07 -0500590
591#define show_nfs4_clp_state(state) \
592 __print_flags(state, "|", \
593 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \
594 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \
595 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \
596 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
597 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
598 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \
599 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \
600 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \
601 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \
602 "SERVER_SCOPE_MISMATCH" }, \
603 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \
604 { NFS4CLNT_BIND_CONN_TO_SESSION, \
605 "BIND_CONN_TO_SESSION" }, \
606 { NFS4CLNT_MOVED, "MOVED" }, \
607 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \
608 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \
609 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \
Trond Myklebustb5fdf842020-02-18 15:58:31 -0500610 { NFS4CLNT_RECALL_RUNNING, "RECALL_RUNNING" }, \
611 { NFS4CLNT_RECALL_ANY_LAYOUT_READ, "RECALL_ANY_LAYOUT_READ" }, \
612 { NFS4CLNT_RECALL_ANY_LAYOUT_RW, "RECALL_ANY_LAYOUT_RW" })
Chuck Lever511ba522019-11-05 11:04:07 -0500613
614TRACE_EVENT(nfs4_state_mgr,
615 TP_PROTO(
616 const struct nfs_client *clp
617 ),
618
619 TP_ARGS(clp),
620
621 TP_STRUCT__entry(
622 __field(unsigned long, state)
623 __string(hostname, clp->cl_hostname)
624 ),
625
626 TP_fast_assign(
627 __entry->state = clp->cl_state;
628 __assign_str(hostname, clp->cl_hostname)
629 ),
630
631 TP_printk(
632 "hostname=%s clp state=%s", __get_str(hostname),
633 show_nfs4_clp_state(__entry->state)
634 )
635)
636
637TRACE_EVENT(nfs4_state_mgr_failed,
638 TP_PROTO(
639 const struct nfs_client *clp,
640 const char *section,
641 int status
642 ),
643
644 TP_ARGS(clp, section, status),
645
646 TP_STRUCT__entry(
647 __field(unsigned long, error)
648 __field(unsigned long, state)
649 __string(hostname, clp->cl_hostname)
650 __string(section, section)
651 ),
652
653 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -0500654 __entry->error = status < 0 ? -status : 0;
Chuck Lever511ba522019-11-05 11:04:07 -0500655 __entry->state = clp->cl_state;
656 __assign_str(hostname, clp->cl_hostname);
657 __assign_str(section, section);
658 ),
659
660 TP_printk(
661 "hostname=%s clp state=%s error=%ld (%s) section=%s",
662 __get_str(hostname),
663 show_nfs4_clp_state(__entry->state), -__entry->error,
664 show_nfsv4_errors(__entry->error), __get_str(section)
665
666 )
667)
668
Trond Myklebustda934ae2021-04-01 14:38:13 -0400669TRACE_EVENT(nfs4_xdr_bad_operation,
670 TP_PROTO(
671 const struct xdr_stream *xdr,
672 u32 op,
673 u32 expected
674 ),
675
676 TP_ARGS(xdr, op, expected),
677
678 TP_STRUCT__entry(
679 __field(unsigned int, task_id)
680 __field(unsigned int, client_id)
681 __field(u32, xid)
682 __field(u32, op)
683 __field(u32, expected)
684 ),
685
686 TP_fast_assign(
687 const struct rpc_rqst *rqstp = xdr->rqst;
688 const struct rpc_task *task = rqstp->rq_task;
689
690 __entry->task_id = task->tk_pid;
691 __entry->client_id = task->tk_client->cl_clid;
692 __entry->xid = be32_to_cpu(rqstp->rq_xid);
693 __entry->op = op;
694 __entry->expected = expected;
695 ),
696
697 TP_printk(
698 "task:%u@%d xid=0x%08x operation=%u, expected=%u",
699 __entry->task_id, __entry->client_id, __entry->xid,
700 __entry->op, __entry->expected
701 )
702);
703
Trond Myklebust3d66bae2021-04-01 13:54:19 -0400704DECLARE_EVENT_CLASS(nfs4_xdr_event,
Chuck Leverf23f6582019-02-11 11:24:26 -0500705 TP_PROTO(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400706 const struct xdr_stream *xdr,
Chuck Leverf23f6582019-02-11 11:24:26 -0500707 u32 op,
Trond Myklebust118b6292020-01-06 15:25:06 -0500708 u32 error
Chuck Leverf23f6582019-02-11 11:24:26 -0500709 ),
710
Chuck Lever62a92ba2019-06-19 10:34:09 -0400711 TP_ARGS(xdr, op, error),
Chuck Leverf23f6582019-02-11 11:24:26 -0500712
713 TP_STRUCT__entry(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400714 __field(unsigned int, task_id)
715 __field(unsigned int, client_id)
716 __field(u32, xid)
Chuck Leverf23f6582019-02-11 11:24:26 -0500717 __field(u32, op)
Chuck Lever96650e22019-06-19 10:33:53 -0400718 __field(unsigned long, error)
Chuck Leverf23f6582019-02-11 11:24:26 -0500719 ),
720
721 TP_fast_assign(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400722 const struct rpc_rqst *rqstp = xdr->rqst;
723 const struct rpc_task *task = rqstp->rq_task;
724
725 __entry->task_id = task->tk_pid;
726 __entry->client_id = task->tk_client->cl_clid;
727 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Leverf23f6582019-02-11 11:24:26 -0500728 __entry->op = op;
Chuck Lever96650e22019-06-19 10:33:53 -0400729 __entry->error = error;
Chuck Leverf23f6582019-02-11 11:24:26 -0500730 ),
731
732 TP_printk(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400733 "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u",
734 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever96650e22019-06-19 10:33:53 -0400735 -__entry->error, show_nfsv4_errors(__entry->error),
736 __entry->op
Chuck Leverf23f6582019-02-11 11:24:26 -0500737 )
738);
Trond Myklebust3d66bae2021-04-01 13:54:19 -0400739#define DEFINE_NFS4_XDR_EVENT(name) \
740 DEFINE_EVENT(nfs4_xdr_event, name, \
741 TP_PROTO( \
742 const struct xdr_stream *xdr, \
743 u32 op, \
744 u32 error \
745 ), \
746 TP_ARGS(xdr, op, error))
747DEFINE_NFS4_XDR_EVENT(nfs4_xdr_status);
Trond Myklebusteb3d58c2021-04-01 14:03:26 -0400748DEFINE_NFS4_XDR_EVENT(nfs4_xdr_bad_filehandle);
Chuck Leverf23f6582019-02-11 11:24:26 -0500749
Chuck Lever2bb50aa2019-12-23 10:28:38 -0500750DECLARE_EVENT_CLASS(nfs4_cb_error_class,
751 TP_PROTO(
752 __be32 xid,
753 u32 cb_ident
754 ),
755
756 TP_ARGS(xid, cb_ident),
757
758 TP_STRUCT__entry(
759 __field(u32, xid)
760 __field(u32, cbident)
761 ),
762
763 TP_fast_assign(
764 __entry->xid = be32_to_cpu(xid);
765 __entry->cbident = cb_ident;
766 ),
767
768 TP_printk(
769 "xid=0x%08x cb_ident=0x%08x",
770 __entry->xid, __entry->cbident
771 )
772);
773
774#define DEFINE_CB_ERROR_EVENT(name) \
775 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
776 TP_PROTO( \
777 __be32 xid, \
778 u32 cb_ident \
779 ), \
780 TP_ARGS(xid, cb_ident))
781
782DEFINE_CB_ERROR_EVENT(no_clp);
783DEFINE_CB_ERROR_EVENT(badprinc);
784
Trond Myklebust42113a72013-08-12 16:19:27 -0400785DECLARE_EVENT_CLASS(nfs4_open_event,
786 TP_PROTO(
787 const struct nfs_open_context *ctx,
788 int flags,
789 int error
790 ),
791
792 TP_ARGS(ctx, flags, error),
793
794 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400795 __field(unsigned long, error)
Trond Myklebust42113a72013-08-12 16:19:27 -0400796 __field(unsigned int, flags)
797 __field(unsigned int, fmode)
798 __field(dev_t, dev)
799 __field(u32, fhandle)
800 __field(u64, fileid)
801 __field(u64, dir)
802 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500803 __field(int, stateid_seq)
804 __field(u32, stateid_hash)
805 __field(int, openstateid_seq)
806 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400807 ),
808
809 TP_fast_assign(
810 const struct nfs4_state *state = ctx->state;
811 const struct inode *inode = NULL;
812
Chuck Lever96650e22019-06-19 10:33:53 -0400813 __entry->error = -error;
Trond Myklebust42113a72013-08-12 16:19:27 -0400814 __entry->flags = flags;
815 __entry->fmode = (__force unsigned int)ctx->mode;
816 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500817 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400818 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500819 __entry->stateid_seq =
820 be32_to_cpu(state->stateid.seqid);
821 __entry->stateid_hash =
822 nfs_stateid_hash(&state->stateid);
823 __entry->openstateid_seq =
824 be32_to_cpu(state->open_stateid.seqid);
825 __entry->openstateid_hash =
826 nfs_stateid_hash(&state->open_stateid);
827 } else {
828 __entry->stateid_seq = 0;
829 __entry->stateid_hash = 0;
830 __entry->openstateid_seq = 0;
831 __entry->openstateid_hash = 0;
832 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400833 if (inode != NULL) {
834 __entry->fileid = NFS_FILEID(inode);
835 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
836 } else {
837 __entry->fileid = 0;
838 __entry->fhandle = 0;
839 }
David Howells2b0143b2015-03-17 22:25:59 +0000840 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400841 __assign_str(name, ctx->dentry->d_name.name);
842 ),
843
844 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400845 "error=%ld (%s) flags=%d (%s) fmode=%s "
Trond Myklebust42113a72013-08-12 16:19:27 -0400846 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500847 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
848 "openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400849 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400850 show_nfsv4_errors(__entry->error),
851 __entry->flags,
852 show_open_flags(__entry->flags),
853 show_fmode_flags(__entry->fmode),
854 MAJOR(__entry->dev), MINOR(__entry->dev),
855 (unsigned long long)__entry->fileid,
856 __entry->fhandle,
857 MAJOR(__entry->dev), MINOR(__entry->dev),
858 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500859 __get_str(name),
860 __entry->stateid_seq, __entry->stateid_hash,
861 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400862 )
863);
864
865#define DEFINE_NFS4_OPEN_EVENT(name) \
866 DEFINE_EVENT(nfs4_open_event, name, \
867 TP_PROTO( \
868 const struct nfs_open_context *ctx, \
869 int flags, \
870 int error \
871 ), \
872 TP_ARGS(ctx, flags, error))
873DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
874DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
875DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
876
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500877TRACE_EVENT(nfs4_cached_open,
878 TP_PROTO(
879 const struct nfs4_state *state
880 ),
881 TP_ARGS(state),
882 TP_STRUCT__entry(
883 __field(dev_t, dev)
884 __field(u32, fhandle)
885 __field(u64, fileid)
886 __field(unsigned int, fmode)
887 __field(int, stateid_seq)
888 __field(u32, stateid_hash)
889 ),
890
891 TP_fast_assign(
892 const struct inode *inode = state->inode;
893
894 __entry->dev = inode->i_sb->s_dev;
895 __entry->fileid = NFS_FILEID(inode);
896 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
897 __entry->fmode = (__force unsigned int)state->state;
898 __entry->stateid_seq =
899 be32_to_cpu(state->stateid.seqid);
900 __entry->stateid_hash =
901 nfs_stateid_hash(&state->stateid);
902 ),
903
904 TP_printk(
905 "fmode=%s fileid=%02x:%02x:%llu "
906 "fhandle=0x%08x stateid=%d:0x%08x",
907 __entry->fmode ? show_fmode_flags(__entry->fmode) :
908 "closed",
909 MAJOR(__entry->dev), MINOR(__entry->dev),
910 (unsigned long long)__entry->fileid,
911 __entry->fhandle,
912 __entry->stateid_seq, __entry->stateid_hash
913 )
914);
915
Trond Myklebust42113a72013-08-12 16:19:27 -0400916TRACE_EVENT(nfs4_close,
917 TP_PROTO(
918 const struct nfs4_state *state,
919 const struct nfs_closeargs *args,
920 const struct nfs_closeres *res,
921 int error
922 ),
923
924 TP_ARGS(state, args, res, error),
925
926 TP_STRUCT__entry(
927 __field(dev_t, dev)
928 __field(u32, fhandle)
929 __field(u64, fileid)
930 __field(unsigned int, fmode)
Chuck Lever96650e22019-06-19 10:33:53 -0400931 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500932 __field(int, stateid_seq)
933 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400934 ),
935
936 TP_fast_assign(
937 const struct inode *inode = state->inode;
938
939 __entry->dev = inode->i_sb->s_dev;
940 __entry->fileid = NFS_FILEID(inode);
941 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
942 __entry->fmode = (__force unsigned int)state->state;
Trond Myklebust118b6292020-01-06 15:25:06 -0500943 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500944 __entry->stateid_seq =
945 be32_to_cpu(args->stateid.seqid);
946 __entry->stateid_hash =
947 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400948 ),
949
950 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400951 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500952 "fhandle=0x%08x openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400953 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400954 show_nfsv4_errors(__entry->error),
955 __entry->fmode ? show_fmode_flags(__entry->fmode) :
956 "closed",
957 MAJOR(__entry->dev), MINOR(__entry->dev),
958 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500959 __entry->fhandle,
960 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400961 )
962);
963
Chuck Lever5b2095d2018-12-19 11:00:11 -0500964TRACE_DEFINE_ENUM(F_GETLK);
965TRACE_DEFINE_ENUM(F_SETLK);
966TRACE_DEFINE_ENUM(F_SETLKW);
967TRACE_DEFINE_ENUM(F_RDLCK);
968TRACE_DEFINE_ENUM(F_WRLCK);
969TRACE_DEFINE_ENUM(F_UNLCK);
970
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400971#define show_lock_cmd(type) \
972 __print_symbolic((int)type, \
973 { F_GETLK, "GETLK" }, \
974 { F_SETLK, "SETLK" }, \
975 { F_SETLKW, "SETLKW" })
976#define show_lock_type(type) \
977 __print_symbolic((int)type, \
978 { F_RDLCK, "RDLCK" }, \
979 { F_WRLCK, "WRLCK" }, \
980 { F_UNLCK, "UNLCK" })
981
982DECLARE_EVENT_CLASS(nfs4_lock_event,
983 TP_PROTO(
984 const struct file_lock *request,
985 const struct nfs4_state *state,
986 int cmd,
987 int error
988 ),
989
990 TP_ARGS(request, state, cmd, error),
991
992 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400993 __field(unsigned long, error)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400994 __field(int, cmd)
995 __field(char, type)
996 __field(loff_t, start)
997 __field(loff_t, end)
998 __field(dev_t, dev)
999 __field(u32, fhandle)
1000 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001001 __field(int, stateid_seq)
1002 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001003 ),
1004
1005 TP_fast_assign(
1006 const struct inode *inode = state->inode;
1007
Trond Myklebust118b6292020-01-06 15:25:06 -05001008 __entry->error = error < 0 ? -error : 0;
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001009 __entry->cmd = cmd;
1010 __entry->type = request->fl_type;
1011 __entry->start = request->fl_start;
1012 __entry->end = request->fl_end;
1013 __entry->dev = inode->i_sb->s_dev;
1014 __entry->fileid = NFS_FILEID(inode);
1015 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001016 __entry->stateid_seq =
1017 be32_to_cpu(state->stateid.seqid);
1018 __entry->stateid_hash =
1019 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001020 ),
1021
1022 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001023 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001024 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1025 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001026 -__entry->error,
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001027 show_nfsv4_errors(__entry->error),
1028 show_lock_cmd(__entry->cmd),
1029 show_lock_type(__entry->type),
1030 (long long)__entry->start,
1031 (long long)__entry->end,
1032 MAJOR(__entry->dev), MINOR(__entry->dev),
1033 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001034 __entry->fhandle,
1035 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001036 )
1037);
1038
1039#define DEFINE_NFS4_LOCK_EVENT(name) \
1040 DEFINE_EVENT(nfs4_lock_event, name, \
1041 TP_PROTO( \
1042 const struct file_lock *request, \
1043 const struct nfs4_state *state, \
1044 int cmd, \
1045 int error \
1046 ), \
1047 TP_ARGS(request, state, cmd, error))
1048DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001049DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
1050
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001051TRACE_EVENT(nfs4_set_lock,
1052 TP_PROTO(
1053 const struct file_lock *request,
1054 const struct nfs4_state *state,
1055 const nfs4_stateid *lockstateid,
1056 int cmd,
1057 int error
1058 ),
1059
1060 TP_ARGS(request, state, lockstateid, cmd, error),
1061
1062 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001063 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001064 __field(int, cmd)
1065 __field(char, type)
1066 __field(loff_t, start)
1067 __field(loff_t, end)
1068 __field(dev_t, dev)
1069 __field(u32, fhandle)
1070 __field(u64, fileid)
1071 __field(int, stateid_seq)
1072 __field(u32, stateid_hash)
1073 __field(int, lockstateid_seq)
1074 __field(u32, lockstateid_hash)
1075 ),
1076
1077 TP_fast_assign(
1078 const struct inode *inode = state->inode;
1079
Trond Myklebust118b6292020-01-06 15:25:06 -05001080 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001081 __entry->cmd = cmd;
1082 __entry->type = request->fl_type;
1083 __entry->start = request->fl_start;
1084 __entry->end = request->fl_end;
1085 __entry->dev = inode->i_sb->s_dev;
1086 __entry->fileid = NFS_FILEID(inode);
1087 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1088 __entry->stateid_seq =
1089 be32_to_cpu(state->stateid.seqid);
1090 __entry->stateid_hash =
1091 nfs_stateid_hash(&state->stateid);
1092 __entry->lockstateid_seq =
1093 be32_to_cpu(lockstateid->seqid);
1094 __entry->lockstateid_hash =
1095 nfs_stateid_hash(lockstateid);
1096 ),
1097
1098 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001099 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001100 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1101 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001102 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001103 show_nfsv4_errors(__entry->error),
1104 show_lock_cmd(__entry->cmd),
1105 show_lock_type(__entry->type),
1106 (long long)__entry->start,
1107 (long long)__entry->end,
1108 MAJOR(__entry->dev), MINOR(__entry->dev),
1109 (unsigned long long)__entry->fileid,
1110 __entry->fhandle,
1111 __entry->stateid_seq, __entry->stateid_hash,
1112 __entry->lockstateid_seq, __entry->lockstateid_hash
1113 )
1114);
1115
Chuck Lever21f86d22019-11-05 11:04:13 -05001116TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
1117TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
1118TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
1119TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
1120TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
1121TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
1122TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
1123TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
1124TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
1125TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
1126TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
1127TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
1128TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
1129TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
1130TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
1131
1132#define show_nfs4_state_flags(flags) \
1133 __print_flags(flags, "|", \
1134 { LK_STATE_IN_USE, "IN_USE" }, \
1135 { NFS_DELEGATED_STATE, "DELEGATED" }, \
1136 { NFS_OPEN_STATE, "OPEN" }, \
1137 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
1138 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
1139 { NFS_O_RDWR_STATE, "O_RDWR" }, \
1140 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
1141 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
1142 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
1143 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
1144 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
1145 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
1146 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
1147 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
1148 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
1149
1150#define show_nfs4_lock_flags(flags) \
1151 __print_flags(flags, "|", \
1152 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
1153 { BIT(NFS_LOCK_LOST), "LOST" })
1154
1155TRACE_EVENT(nfs4_state_lock_reclaim,
1156 TP_PROTO(
1157 const struct nfs4_state *state,
1158 const struct nfs4_lock_state *lock
1159 ),
1160
1161 TP_ARGS(state, lock),
1162
1163 TP_STRUCT__entry(
1164 __field(dev_t, dev)
1165 __field(u32, fhandle)
1166 __field(u64, fileid)
1167 __field(unsigned long, state_flags)
1168 __field(unsigned long, lock_flags)
1169 __field(int, stateid_seq)
1170 __field(u32, stateid_hash)
1171 ),
1172
1173 TP_fast_assign(
1174 const struct inode *inode = state->inode;
1175
1176 __entry->dev = inode->i_sb->s_dev;
1177 __entry->fileid = NFS_FILEID(inode);
1178 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1179 __entry->state_flags = state->flags;
1180 __entry->lock_flags = lock->ls_flags;
1181 __entry->stateid_seq =
1182 be32_to_cpu(state->stateid.seqid);
1183 __entry->stateid_hash =
1184 nfs_stateid_hash(&state->stateid);
1185 ),
1186
1187 TP_printk(
1188 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1189 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
1190 MAJOR(__entry->dev), MINOR(__entry->dev),
1191 (unsigned long long)__entry->fileid, __entry->fhandle,
1192 __entry->stateid_seq, __entry->stateid_hash,
1193 show_nfs4_state_flags(__entry->state_flags),
1194 show_nfs4_lock_flags(__entry->lock_flags)
1195 )
1196)
1197
Trond Myklebustca8acf82013-08-13 10:36:56 -04001198DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
1199 TP_PROTO(
1200 const struct inode *inode,
1201 fmode_t fmode
1202 ),
1203
1204 TP_ARGS(inode, fmode),
1205
1206 TP_STRUCT__entry(
1207 __field(dev_t, dev)
1208 __field(u32, fhandle)
1209 __field(u64, fileid)
1210 __field(unsigned int, fmode)
1211 ),
1212
1213 TP_fast_assign(
1214 __entry->dev = inode->i_sb->s_dev;
1215 __entry->fileid = NFS_FILEID(inode);
1216 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1217 __entry->fmode = (__force unsigned int)fmode;
1218 ),
1219
1220 TP_printk(
1221 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
1222 show_fmode_flags(__entry->fmode),
1223 MAJOR(__entry->dev), MINOR(__entry->dev),
1224 (unsigned long long)__entry->fileid,
1225 __entry->fhandle
1226 )
1227);
1228#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
1229 DEFINE_EVENT(nfs4_set_delegation_event, name, \
1230 TP_PROTO( \
1231 const struct inode *inode, \
1232 fmode_t fmode \
1233 ), \
1234 TP_ARGS(inode, fmode))
1235DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
1236DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
1237
1238TRACE_EVENT(nfs4_delegreturn_exit,
1239 TP_PROTO(
1240 const struct nfs4_delegreturnargs *args,
1241 const struct nfs4_delegreturnres *res,
1242 int error
1243 ),
1244
1245 TP_ARGS(args, res, error),
1246
1247 TP_STRUCT__entry(
1248 __field(dev_t, dev)
1249 __field(u32, fhandle)
Chuck Lever96650e22019-06-19 10:33:53 -04001250 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001251 __field(int, stateid_seq)
1252 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -04001253 ),
1254
1255 TP_fast_assign(
1256 __entry->dev = res->server->s_dev;
1257 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
Trond Myklebust118b6292020-01-06 15:25:06 -05001258 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001259 __entry->stateid_seq =
1260 be32_to_cpu(args->stateid->seqid);
1261 __entry->stateid_hash =
1262 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -04001263 ),
1264
1265 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001266 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001267 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001268 -__entry->error,
Trond Myklebustca8acf82013-08-13 10:36:56 -04001269 show_nfsv4_errors(__entry->error),
1270 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001271 __entry->fhandle,
1272 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -04001273 )
1274);
1275
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001276#ifdef CONFIG_NFS_V4_1
1277DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
1278 TP_PROTO(
1279 const struct nfs4_state *state,
1280 const struct nfs4_lock_state *lsp,
1281 int error
1282 ),
1283
1284 TP_ARGS(state, lsp, error),
1285
1286 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001287 __field(unsigned long, error)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001288 __field(dev_t, dev)
1289 __field(u32, fhandle)
1290 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001291 __field(int, stateid_seq)
1292 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001293 ),
1294
1295 TP_fast_assign(
1296 const struct inode *inode = state->inode;
1297
Trond Myklebust118b6292020-01-06 15:25:06 -05001298 __entry->error = error < 0 ? -error : 0;
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001299 __entry->dev = inode->i_sb->s_dev;
1300 __entry->fileid = NFS_FILEID(inode);
1301 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001302 __entry->stateid_seq =
1303 be32_to_cpu(state->stateid.seqid);
1304 __entry->stateid_hash =
1305 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001306 ),
1307
1308 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001309 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001310 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001311 -__entry->error,
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001312 show_nfsv4_errors(__entry->error),
1313 MAJOR(__entry->dev), MINOR(__entry->dev),
1314 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001315 __entry->fhandle,
1316 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001317 )
1318);
1319
1320#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1321 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1322 TP_PROTO( \
1323 const struct nfs4_state *state, \
1324 const struct nfs4_lock_state *lsp, \
1325 int error \
1326 ), \
1327 TP_ARGS(state, lsp, error))
1328DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1329DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1330DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1331#endif /* CONFIG_NFS_V4_1 */
1332
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001333DECLARE_EVENT_CLASS(nfs4_lookup_event,
1334 TP_PROTO(
1335 const struct inode *dir,
1336 const struct qstr *name,
1337 int error
1338 ),
1339
1340 TP_ARGS(dir, name, error),
1341
1342 TP_STRUCT__entry(
1343 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001344 __field(unsigned long, error)
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001345 __field(u64, dir)
1346 __string(name, name->name)
1347 ),
1348
1349 TP_fast_assign(
1350 __entry->dev = dir->i_sb->s_dev;
1351 __entry->dir = NFS_FILEID(dir);
Chuck Lever96650e22019-06-19 10:33:53 -04001352 __entry->error = -error;
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001353 __assign_str(name, name->name);
1354 ),
1355
1356 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001357 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1358 -__entry->error,
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001359 show_nfsv4_errors(__entry->error),
1360 MAJOR(__entry->dev), MINOR(__entry->dev),
1361 (unsigned long long)__entry->dir,
1362 __get_str(name)
1363 )
1364);
1365
1366#define DEFINE_NFS4_LOOKUP_EVENT(name) \
1367 DEFINE_EVENT(nfs4_lookup_event, name, \
1368 TP_PROTO( \
1369 const struct inode *dir, \
1370 const struct qstr *name, \
1371 int error \
1372 ), \
1373 TP_ARGS(dir, name, error))
1374
1375DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1376DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1377DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1378DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1379DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1380DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1381DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1382
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001383TRACE_EVENT(nfs4_lookupp,
1384 TP_PROTO(
1385 const struct inode *inode,
1386 int error
1387 ),
1388
1389 TP_ARGS(inode, error),
1390
1391 TP_STRUCT__entry(
1392 __field(dev_t, dev)
1393 __field(u64, ino)
Chuck Lever96650e22019-06-19 10:33:53 -04001394 __field(unsigned long, error)
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001395 ),
1396
1397 TP_fast_assign(
1398 __entry->dev = inode->i_sb->s_dev;
1399 __entry->ino = NFS_FILEID(inode);
Trond Myklebust118b6292020-01-06 15:25:06 -05001400 __entry->error = error < 0 ? -error : 0;
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001401 ),
1402
1403 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001404 "error=%ld (%s) inode=%02x:%02x:%llu",
1405 -__entry->error,
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001406 show_nfsv4_errors(__entry->error),
1407 MAJOR(__entry->dev), MINOR(__entry->dev),
1408 (unsigned long long)__entry->ino
1409 )
1410);
1411
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001412TRACE_EVENT(nfs4_rename,
1413 TP_PROTO(
1414 const struct inode *olddir,
1415 const struct qstr *oldname,
1416 const struct inode *newdir,
1417 const struct qstr *newname,
1418 int error
1419 ),
1420
1421 TP_ARGS(olddir, oldname, newdir, newname, error),
1422
1423 TP_STRUCT__entry(
1424 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001425 __field(unsigned long, error)
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001426 __field(u64, olddir)
1427 __string(oldname, oldname->name)
1428 __field(u64, newdir)
1429 __string(newname, newname->name)
1430 ),
1431
1432 TP_fast_assign(
1433 __entry->dev = olddir->i_sb->s_dev;
1434 __entry->olddir = NFS_FILEID(olddir);
1435 __entry->newdir = NFS_FILEID(newdir);
Trond Myklebust118b6292020-01-06 15:25:06 -05001436 __entry->error = error < 0 ? -error : 0;
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001437 __assign_str(oldname, oldname->name);
1438 __assign_str(newname, newname->name);
1439 ),
1440
1441 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001442 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001443 "newname=%02x:%02x:%llu/%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001444 -__entry->error,
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001445 show_nfsv4_errors(__entry->error),
1446 MAJOR(__entry->dev), MINOR(__entry->dev),
1447 (unsigned long long)__entry->olddir,
1448 __get_str(oldname),
1449 MAJOR(__entry->dev), MINOR(__entry->dev),
1450 (unsigned long long)__entry->newdir,
1451 __get_str(newname)
1452 )
1453);
1454
Trond Myklebustc1578b72013-08-12 16:58:42 -04001455DECLARE_EVENT_CLASS(nfs4_inode_event,
1456 TP_PROTO(
1457 const struct inode *inode,
1458 int error
1459 ),
1460
1461 TP_ARGS(inode, error),
1462
1463 TP_STRUCT__entry(
1464 __field(dev_t, dev)
1465 __field(u32, fhandle)
1466 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001467 __field(unsigned long, error)
Trond Myklebustc1578b72013-08-12 16:58:42 -04001468 ),
1469
1470 TP_fast_assign(
1471 __entry->dev = inode->i_sb->s_dev;
1472 __entry->fileid = NFS_FILEID(inode);
1473 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Chuck Lever96650e22019-06-19 10:33:53 -04001474 __entry->error = error < 0 ? -error : 0;
Trond Myklebustc1578b72013-08-12 16:58:42 -04001475 ),
1476
1477 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001478 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1479 -__entry->error,
Trond Myklebustc1578b72013-08-12 16:58:42 -04001480 show_nfsv4_errors(__entry->error),
1481 MAJOR(__entry->dev), MINOR(__entry->dev),
1482 (unsigned long long)__entry->fileid,
1483 __entry->fhandle
1484 )
1485);
1486
1487#define DEFINE_NFS4_INODE_EVENT(name) \
1488 DEFINE_EVENT(nfs4_inode_event, name, \
1489 TP_PROTO( \
1490 const struct inode *inode, \
1491 int error \
1492 ), \
1493 TP_ARGS(inode, error))
1494
Trond Myklebustc1578b72013-08-12 16:58:42 -04001495DEFINE_NFS4_INODE_EVENT(nfs4_access);
1496DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1497DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1498DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1499DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1500#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1501DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1502DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1503#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001504
1505DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1506 TP_PROTO(
1507 const struct inode *inode,
1508 const nfs4_stateid *stateid,
1509 int error
1510 ),
1511
1512 TP_ARGS(inode, stateid, error),
1513
1514 TP_STRUCT__entry(
1515 __field(dev_t, dev)
1516 __field(u32, fhandle)
1517 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001518 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001519 __field(int, stateid_seq)
1520 __field(u32, stateid_hash)
1521 ),
1522
1523 TP_fast_assign(
1524 __entry->dev = inode->i_sb->s_dev;
1525 __entry->fileid = NFS_FILEID(inode);
1526 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Trond Myklebust118b6292020-01-06 15:25:06 -05001527 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001528 __entry->stateid_seq =
1529 be32_to_cpu(stateid->seqid);
1530 __entry->stateid_hash =
1531 nfs_stateid_hash(stateid);
1532 ),
1533
1534 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001535 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001536 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001537 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001538 show_nfsv4_errors(__entry->error),
1539 MAJOR(__entry->dev), MINOR(__entry->dev),
1540 (unsigned long long)__entry->fileid,
1541 __entry->fhandle,
1542 __entry->stateid_seq, __entry->stateid_hash
1543 )
1544);
1545
1546#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1547 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1548 TP_PROTO( \
1549 const struct inode *inode, \
1550 const nfs4_stateid *stateid, \
1551 int error \
1552 ), \
1553 TP_ARGS(inode, stateid, error))
1554
1555DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1556DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustad9e02d2017-11-06 15:28:02 -05001557DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1558DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
Benjamin Coddingtonb4868b42020-09-25 15:48:39 -04001559DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001560
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001561DECLARE_EVENT_CLASS(nfs4_getattr_event,
1562 TP_PROTO(
1563 const struct nfs_server *server,
1564 const struct nfs_fh *fhandle,
1565 const struct nfs_fattr *fattr,
1566 int error
1567 ),
1568
1569 TP_ARGS(server, fhandle, fattr, error),
1570
1571 TP_STRUCT__entry(
1572 __field(dev_t, dev)
1573 __field(u32, fhandle)
1574 __field(u64, fileid)
1575 __field(unsigned int, valid)
Chuck Lever96650e22019-06-19 10:33:53 -04001576 __field(unsigned long, error)
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001577 ),
1578
1579 TP_fast_assign(
1580 __entry->dev = server->s_dev;
1581 __entry->valid = fattr->valid;
1582 __entry->fhandle = nfs_fhandle_hash(fhandle);
1583 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
Trond Myklebust118b6292020-01-06 15:25:06 -05001584 __entry->error = error < 0 ? -error : 0;
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001585 ),
1586
1587 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001588 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001589 "valid=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001590 -__entry->error,
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001591 show_nfsv4_errors(__entry->error),
1592 MAJOR(__entry->dev), MINOR(__entry->dev),
1593 (unsigned long long)__entry->fileid,
1594 __entry->fhandle,
1595 show_nfs_fattr_flags(__entry->valid)
1596 )
1597);
1598
1599#define DEFINE_NFS4_GETATTR_EVENT(name) \
1600 DEFINE_EVENT(nfs4_getattr_event, name, \
1601 TP_PROTO( \
1602 const struct nfs_server *server, \
1603 const struct nfs_fh *fhandle, \
1604 const struct nfs_fattr *fattr, \
1605 int error \
1606 ), \
1607 TP_ARGS(server, fhandle, fattr, error))
1608DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1609DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1610DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1611
Trond Myklebust7cd14862015-08-20 20:07:54 -05001612DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1613 TP_PROTO(
1614 const struct nfs_client *clp,
1615 const struct nfs_fh *fhandle,
1616 const struct inode *inode,
1617 int error
1618 ),
1619
1620 TP_ARGS(clp, fhandle, inode, error),
1621
1622 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001623 __field(unsigned long, error)
Trond Myklebust7cd14862015-08-20 20:07:54 -05001624 __field(dev_t, dev)
1625 __field(u32, fhandle)
1626 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001627 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001628 ),
1629
1630 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001631 __entry->error = error < 0 ? -error : 0;
Trond Myklebust7cd14862015-08-20 20:07:54 -05001632 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2edaead2018-09-05 14:07:13 -04001633 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebust7cd14862015-08-20 20:07:54 -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 Myklebust7cd14862015-08-20 20:07:54 -05001641 ),
1642
1643 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001644 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7cd14862015-08-20 20:07:54 -05001645 "dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001646 -__entry->error,
Trond Myklebust7cd14862015-08-20 20:07:54 -05001647 show_nfsv4_errors(__entry->error),
1648 MAJOR(__entry->dev), MINOR(__entry->dev),
1649 (unsigned long long)__entry->fileid,
1650 __entry->fhandle,
1651 __get_str(dstaddr)
1652 )
1653);
1654
1655#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1656 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1657 TP_PROTO( \
1658 const struct nfs_client *clp, \
1659 const struct nfs_fh *fhandle, \
1660 const struct inode *inode, \
1661 int error \
1662 ), \
1663 TP_ARGS(clp, fhandle, inode, error))
1664DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1665
Trond Myklebuste07db902015-12-28 14:07:23 -05001666DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1667 TP_PROTO(
1668 const struct nfs_client *clp,
1669 const struct nfs_fh *fhandle,
1670 const struct inode *inode,
1671 const nfs4_stateid *stateid,
1672 int error
1673 ),
1674
1675 TP_ARGS(clp, fhandle, inode, stateid, error),
1676
1677 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001678 __field(unsigned long, error)
Trond Myklebuste07db902015-12-28 14:07:23 -05001679 __field(dev_t, dev)
1680 __field(u32, fhandle)
1681 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001682 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001683 __field(int, stateid_seq)
1684 __field(u32, stateid_hash)
1685 ),
1686
1687 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001688 __entry->error = error < 0 ? -error : 0;
Trond Myklebuste07db902015-12-28 14:07:23 -05001689 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2a534a72018-08-23 11:02:49 -04001690 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebuste07db902015-12-28 14:07:23 -05001691 __entry->fileid = NFS_FILEID(inode);
1692 __entry->dev = inode->i_sb->s_dev;
1693 } else {
1694 __entry->fileid = 0;
1695 __entry->dev = 0;
1696 }
Anna Schumaker39443692017-11-01 15:48:43 -04001697 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001698 __entry->stateid_seq =
1699 be32_to_cpu(stateid->seqid);
1700 __entry->stateid_hash =
1701 nfs_stateid_hash(stateid);
1702 ),
1703
1704 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001705 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebuste07db902015-12-28 14:07:23 -05001706 "stateid=%d:0x%08x dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001707 -__entry->error,
Trond Myklebuste07db902015-12-28 14:07:23 -05001708 show_nfsv4_errors(__entry->error),
1709 MAJOR(__entry->dev), MINOR(__entry->dev),
1710 (unsigned long long)__entry->fileid,
1711 __entry->fhandle,
1712 __entry->stateid_seq, __entry->stateid_hash,
1713 __get_str(dstaddr)
1714 )
1715);
1716
1717#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1718 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1719 TP_PROTO( \
1720 const struct nfs_client *clp, \
1721 const struct nfs_fh *fhandle, \
1722 const struct inode *inode, \
1723 const nfs4_stateid *stateid, \
1724 int error \
1725 ), \
1726 TP_ARGS(clp, fhandle, inode, stateid, error))
1727DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1728DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001729
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001730DECLARE_EVENT_CLASS(nfs4_idmap_event,
1731 TP_PROTO(
1732 const char *name,
1733 int len,
1734 u32 id,
1735 int error
1736 ),
1737
1738 TP_ARGS(name, len, id, error),
1739
1740 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001741 __field(unsigned long, error)
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001742 __field(u32, id)
1743 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1744 ),
1745
1746 TP_fast_assign(
1747 if (len < 0)
1748 len = 0;
1749 __entry->error = error < 0 ? error : 0;
1750 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001751 memcpy(__get_str(name), name, len);
1752 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001753 ),
1754
1755 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001756 "error=%ld (%s) id=%u name=%s",
1757 -__entry->error, show_nfsv4_errors(__entry->error),
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001758 __entry->id,
1759 __get_str(name)
1760 )
1761);
1762#define DEFINE_NFS4_IDMAP_EVENT(name) \
1763 DEFINE_EVENT(nfs4_idmap_event, name, \
1764 TP_PROTO( \
1765 const char *name, \
1766 int len, \
1767 u32 id, \
1768 int error \
1769 ), \
1770 TP_ARGS(name, len, id, error))
1771DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1772DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1773DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1774DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1775
Trond Myklebust54898f72020-08-04 22:16:06 -04001776#ifdef CONFIG_NFS_V4_1
1777#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
1778 (lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
1779#else
1780#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
1781#endif
1782
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001783DECLARE_EVENT_CLASS(nfs4_read_event,
1784 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001785 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001786 int error
1787 ),
1788
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001789 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001790
1791 TP_STRUCT__entry(
1792 __field(dev_t, dev)
1793 __field(u32, fhandle)
1794 __field(u64, fileid)
1795 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001796 __field(u32, arg_count)
1797 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001798 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001799 __field(int, stateid_seq)
1800 __field(u32, stateid_hash)
Trond Myklebust54898f72020-08-04 22:16:06 -04001801 __field(int, layoutstateid_seq)
1802 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001803 ),
1804
1805 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001806 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001807 const struct nfs_inode *nfsi = NFS_I(inode);
1808 const struct nfs_fh *fh = hdr->args.fh ?
1809 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001810 const struct nfs4_state *state =
1811 hdr->args.context->state;
Trond Myklebust54898f72020-08-04 22:16:06 -04001812 const struct pnfs_layout_segment *lseg = hdr->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001813
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001814 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001815 __entry->fileid = nfsi->fileid;
1816 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001817 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001818 __entry->arg_count = hdr->args.count;
1819 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001820 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001821 __entry->stateid_seq =
1822 be32_to_cpu(state->stateid.seqid);
1823 __entry->stateid_hash =
1824 nfs_stateid_hash(&state->stateid);
Trond Myklebust54898f72020-08-04 22:16:06 -04001825 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1826 __entry->layoutstateid_hash =
1827 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001828 ),
1829
1830 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001831 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001832 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1833 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001834 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001835 show_nfsv4_errors(__entry->error),
1836 MAJOR(__entry->dev), MINOR(__entry->dev),
1837 (unsigned long long)__entry->fileid,
1838 __entry->fhandle,
1839 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001840 __entry->arg_count, __entry->res_count,
Trond Myklebust54898f72020-08-04 22:16:06 -04001841 __entry->stateid_seq, __entry->stateid_hash,
1842 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001843 )
1844);
1845#define DEFINE_NFS4_READ_EVENT(name) \
1846 DEFINE_EVENT(nfs4_read_event, name, \
1847 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001848 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001849 int error \
1850 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001851 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001852DEFINE_NFS4_READ_EVENT(nfs4_read);
1853#ifdef CONFIG_NFS_V4_1
1854DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1855#endif /* CONFIG_NFS_V4_1 */
1856
1857DECLARE_EVENT_CLASS(nfs4_write_event,
1858 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001859 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001860 int error
1861 ),
1862
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001863 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001864
1865 TP_STRUCT__entry(
1866 __field(dev_t, dev)
1867 __field(u32, fhandle)
1868 __field(u64, fileid)
1869 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001870 __field(u32, arg_count)
1871 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001872 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001873 __field(int, stateid_seq)
1874 __field(u32, stateid_hash)
Trond Myklebust54898f72020-08-04 22:16:06 -04001875 __field(int, layoutstateid_seq)
1876 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001877 ),
1878
1879 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001880 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001881 const struct nfs_inode *nfsi = NFS_I(inode);
1882 const struct nfs_fh *fh = hdr->args.fh ?
1883 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001884 const struct nfs4_state *state =
1885 hdr->args.context->state;
Trond Myklebust54898f72020-08-04 22:16:06 -04001886 const struct pnfs_layout_segment *lseg = hdr->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001887
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001888 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001889 __entry->fileid = nfsi->fileid;
1890 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001891 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001892 __entry->arg_count = hdr->args.count;
1893 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001894 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001895 __entry->stateid_seq =
1896 be32_to_cpu(state->stateid.seqid);
1897 __entry->stateid_hash =
1898 nfs_stateid_hash(&state->stateid);
Trond Myklebust54898f72020-08-04 22:16:06 -04001899 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1900 __entry->layoutstateid_hash =
1901 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001902 ),
1903
1904 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001905 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001906 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1907 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001908 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001909 show_nfsv4_errors(__entry->error),
1910 MAJOR(__entry->dev), MINOR(__entry->dev),
1911 (unsigned long long)__entry->fileid,
1912 __entry->fhandle,
1913 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001914 __entry->arg_count, __entry->res_count,
Trond Myklebust54898f72020-08-04 22:16:06 -04001915 __entry->stateid_seq, __entry->stateid_hash,
1916 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001917 )
1918);
1919
1920#define DEFINE_NFS4_WRITE_EVENT(name) \
1921 DEFINE_EVENT(nfs4_write_event, name, \
1922 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001923 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001924 int error \
1925 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001926 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001927DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1928#ifdef CONFIG_NFS_V4_1
1929DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1930#endif /* CONFIG_NFS_V4_1 */
1931
1932DECLARE_EVENT_CLASS(nfs4_commit_event,
1933 TP_PROTO(
1934 const struct nfs_commit_data *data,
1935 int error
1936 ),
1937
1938 TP_ARGS(data, error),
1939
1940 TP_STRUCT__entry(
1941 __field(dev_t, dev)
1942 __field(u32, fhandle)
1943 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001944 __field(unsigned long, error)
Trond Myklebust25925b02020-01-06 15:25:05 -05001945 __field(loff_t, offset)
1946 __field(u32, count)
Trond Myklebust54898f72020-08-04 22:16:06 -04001947 __field(int, layoutstateid_seq)
1948 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001949 ),
1950
1951 TP_fast_assign(
1952 const struct inode *inode = data->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001953 const struct nfs_inode *nfsi = NFS_I(inode);
1954 const struct nfs_fh *fh = data->args.fh ?
1955 data->args.fh : &nfsi->fh;
Trond Myklebust54898f72020-08-04 22:16:06 -04001956 const struct pnfs_layout_segment *lseg = data->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001957
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001958 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001959 __entry->fileid = nfsi->fileid;
1960 __entry->fhandle = nfs_fhandle_hash(fh);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001961 __entry->offset = data->args.offset;
1962 __entry->count = data->args.count;
Trond Myklebust25925b02020-01-06 15:25:05 -05001963 __entry->error = error < 0 ? -error : 0;
Trond Myklebust54898f72020-08-04 22:16:06 -04001964 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1965 __entry->layoutstateid_hash =
1966 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001967 ),
1968
1969 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001970 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001971 "offset=%lld count=%u layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001972 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001973 show_nfsv4_errors(__entry->error),
1974 MAJOR(__entry->dev), MINOR(__entry->dev),
1975 (unsigned long long)__entry->fileid,
1976 __entry->fhandle,
1977 (long long)__entry->offset,
Trond Myklebust54898f72020-08-04 22:16:06 -04001978 __entry->count,
1979 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001980 )
1981);
1982#define DEFINE_NFS4_COMMIT_EVENT(name) \
1983 DEFINE_EVENT(nfs4_commit_event, name, \
1984 TP_PROTO( \
1985 const struct nfs_commit_data *data, \
1986 int error \
1987 ), \
1988 TP_ARGS(data, error))
1989DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1990#ifdef CONFIG_NFS_V4_1
1991DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001992
Chuck Lever5b2095d2018-12-19 11:00:11 -05001993TRACE_DEFINE_ENUM(IOMODE_READ);
1994TRACE_DEFINE_ENUM(IOMODE_RW);
1995TRACE_DEFINE_ENUM(IOMODE_ANY);
1996
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001997#define show_pnfs_iomode(iomode) \
1998 __print_symbolic(iomode, \
1999 { IOMODE_READ, "READ" }, \
2000 { IOMODE_RW, "RW" }, \
2001 { IOMODE_ANY, "ANY" })
2002
2003TRACE_EVENT(nfs4_layoutget,
2004 TP_PROTO(
2005 const struct nfs_open_context *ctx,
2006 const struct pnfs_layout_range *args,
2007 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002008 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002009 int error
2010 ),
2011
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002012 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002013
2014 TP_STRUCT__entry(
2015 __field(dev_t, dev)
2016 __field(u32, fhandle)
2017 __field(u64, fileid)
2018 __field(u32, iomode)
2019 __field(u64, offset)
2020 __field(u64, count)
Chuck Lever96650e22019-06-19 10:33:53 -04002021 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002022 __field(int, stateid_seq)
2023 __field(u32, stateid_hash)
2024 __field(int, layoutstateid_seq)
2025 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002026 ),
2027
2028 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00002029 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002030 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002031 __entry->dev = inode->i_sb->s_dev;
2032 __entry->fileid = NFS_FILEID(inode);
2033 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2034 __entry->iomode = args->iomode;
2035 __entry->offset = args->offset;
2036 __entry->count = args->length;
Trond Myklebust118b6292020-01-06 15:25:06 -05002037 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002038 __entry->stateid_seq =
2039 be32_to_cpu(state->stateid.seqid);
2040 __entry->stateid_hash =
2041 nfs_stateid_hash(&state->stateid);
2042 if (!error) {
2043 __entry->layoutstateid_seq =
2044 be32_to_cpu(layout_stateid->seqid);
2045 __entry->layoutstateid_hash =
2046 nfs_stateid_hash(layout_stateid);
2047 } else {
2048 __entry->layoutstateid_seq = 0;
2049 __entry->layoutstateid_hash = 0;
2050 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002051 ),
2052
2053 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04002054 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002055 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
2056 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04002057 -__entry->error,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002058 show_nfsv4_errors(__entry->error),
2059 MAJOR(__entry->dev), MINOR(__entry->dev),
2060 (unsigned long long)__entry->fileid,
2061 __entry->fhandle,
2062 show_pnfs_iomode(__entry->iomode),
2063 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002064 (unsigned long long)__entry->count,
2065 __entry->stateid_seq, __entry->stateid_hash,
2066 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002067 )
2068);
2069
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002070DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
2071DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebusta19b4782020-08-03 18:32:28 -04002072DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust638037b2020-08-04 11:02:44 -04002073DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror);
2074DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002075
Chuck Lever5b2095d2018-12-19 11:00:11 -05002076TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
2077TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
2078TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
2079TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
2080TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
2081TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
2082TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
2083TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
2084TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
2085TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
2086TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
2087TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
2088TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
Trond Myklebustd5b92162019-07-18 09:32:17 -04002089TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
Chuck Lever5b2095d2018-12-19 11:00:11 -05002090
Jeff Layton9a4bf312015-12-10 10:41:58 -05002091#define show_pnfs_update_layout_reason(reason) \
2092 __print_symbolic(reason, \
2093 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
2094 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
2095 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
2096 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
2097 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
2098 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
2099 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
2100 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
2101 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
2102 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04002103 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
2104 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Trond Myklebustd5b92162019-07-18 09:32:17 -04002105 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
2106 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
Jeff Layton9a4bf312015-12-10 10:41:58 -05002107
2108TRACE_EVENT(pnfs_update_layout,
2109 TP_PROTO(struct inode *inode,
2110 loff_t pos,
2111 u64 count,
2112 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05002113 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04002114 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002115 enum pnfs_update_layout_reason reason
2116 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04002117 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05002118 TP_STRUCT__entry(
2119 __field(dev_t, dev)
2120 __field(u64, fileid)
2121 __field(u32, fhandle)
2122 __field(loff_t, pos)
2123 __field(u64, count)
2124 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05002125 __field(int, layoutstateid_seq)
2126 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04002127 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05002128 __field(enum pnfs_update_layout_reason, reason)
2129 ),
2130 TP_fast_assign(
2131 __entry->dev = inode->i_sb->s_dev;
2132 __entry->fileid = NFS_FILEID(inode);
2133 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2134 __entry->pos = pos;
2135 __entry->count = count;
2136 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002137 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05002138 if (lo != NULL) {
2139 __entry->layoutstateid_seq =
2140 be32_to_cpu(lo->plh_stateid.seqid);
2141 __entry->layoutstateid_hash =
2142 nfs_stateid_hash(&lo->plh_stateid);
2143 } else {
2144 __entry->layoutstateid_seq = 0;
2145 __entry->layoutstateid_hash = 0;
2146 }
Jeff Layton183d9e72016-05-17 12:28:47 -04002147 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002148 ),
2149 TP_printk(
2150 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05002151 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04002152 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05002153 MAJOR(__entry->dev), MINOR(__entry->dev),
2154 (unsigned long long)__entry->fileid,
2155 __entry->fhandle,
2156 show_pnfs_iomode(__entry->iomode),
2157 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05002158 (unsigned long long)__entry->count,
2159 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04002160 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002161 show_pnfs_update_layout_reason(__entry->reason)
2162 )
2163);
2164
Trond Myklebustd5b92162019-07-18 09:32:17 -04002165DECLARE_EVENT_CLASS(pnfs_layout_event,
2166 TP_PROTO(struct inode *inode,
2167 loff_t pos,
2168 u64 count,
2169 enum pnfs_iomode iomode,
2170 struct pnfs_layout_hdr *lo,
2171 struct pnfs_layout_segment *lseg
2172 ),
2173 TP_ARGS(inode, pos, count, iomode, lo, lseg),
2174 TP_STRUCT__entry(
2175 __field(dev_t, dev)
2176 __field(u64, fileid)
2177 __field(u32, fhandle)
2178 __field(loff_t, pos)
2179 __field(u64, count)
2180 __field(enum pnfs_iomode, iomode)
2181 __field(int, layoutstateid_seq)
2182 __field(u32, layoutstateid_hash)
2183 __field(long, lseg)
2184 ),
2185 TP_fast_assign(
2186 __entry->dev = inode->i_sb->s_dev;
2187 __entry->fileid = NFS_FILEID(inode);
2188 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2189 __entry->pos = pos;
2190 __entry->count = count;
2191 __entry->iomode = iomode;
2192 if (lo != NULL) {
2193 __entry->layoutstateid_seq =
2194 be32_to_cpu(lo->plh_stateid.seqid);
2195 __entry->layoutstateid_hash =
2196 nfs_stateid_hash(&lo->plh_stateid);
2197 } else {
2198 __entry->layoutstateid_seq = 0;
2199 __entry->layoutstateid_hash = 0;
2200 }
2201 __entry->lseg = (long)lseg;
2202 ),
2203 TP_printk(
2204 "fileid=%02x:%02x:%llu fhandle=0x%08x "
2205 "iomode=%s pos=%llu count=%llu "
2206 "layoutstateid=%d:0x%08x lseg=0x%lx",
2207 MAJOR(__entry->dev), MINOR(__entry->dev),
2208 (unsigned long long)__entry->fileid,
2209 __entry->fhandle,
2210 show_pnfs_iomode(__entry->iomode),
2211 (unsigned long long)__entry->pos,
2212 (unsigned long long)__entry->count,
2213 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
2214 __entry->lseg
2215 )
2216);
2217
2218#define DEFINE_PNFS_LAYOUT_EVENT(name) \
2219 DEFINE_EVENT(pnfs_layout_event, name, \
2220 TP_PROTO(struct inode *inode, \
2221 loff_t pos, \
2222 u64 count, \
2223 enum pnfs_iomode iomode, \
2224 struct pnfs_layout_hdr *lo, \
2225 struct pnfs_layout_segment *lseg \
2226 ), \
2227 TP_ARGS(inode, pos, count, iomode, lo, lseg))
2228
2229DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
2230DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
2231DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
2232DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
2233DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
2234DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
2235DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
2236
Trond Myklebustcac1d3a2020-12-16 16:31:26 -05002237DECLARE_EVENT_CLASS(nfs4_deviceid_event,
2238 TP_PROTO(
2239 const struct nfs_client *clp,
2240 const struct nfs4_deviceid *deviceid
2241 ),
2242
2243 TP_ARGS(clp, deviceid),
2244
2245 TP_STRUCT__entry(
2246 __string(dstaddr, clp->cl_hostname)
2247 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
2248 ),
2249
2250 TP_fast_assign(
2251 __assign_str(dstaddr, clp->cl_hostname);
2252 memcpy(__entry->deviceid, deviceid->data,
2253 NFS4_DEVICEID4_SIZE);
2254 ),
2255
2256 TP_printk(
2257 "deviceid=%s, dstaddr=%s",
2258 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
2259 __get_str(dstaddr)
2260 )
2261);
2262#define DEFINE_PNFS_DEVICEID_EVENT(name) \
2263 DEFINE_EVENT(nfs4_deviceid_event, name, \
2264 TP_PROTO(const struct nfs_client *clp, \
2265 const struct nfs4_deviceid *deviceid \
2266 ), \
2267 TP_ARGS(clp, deviceid))
2268DEFINE_PNFS_DEVICEID_EVENT(nfs4_deviceid_free);
2269
2270DECLARE_EVENT_CLASS(nfs4_deviceid_status,
2271 TP_PROTO(
2272 const struct nfs_server *server,
2273 const struct nfs4_deviceid *deviceid,
2274 int status
2275 ),
2276
2277 TP_ARGS(server, deviceid, status),
2278
2279 TP_STRUCT__entry(
2280 __field(dev_t, dev)
2281 __field(int, status)
2282 __string(dstaddr, server->nfs_client->cl_hostname)
2283 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
2284 ),
2285
2286 TP_fast_assign(
2287 __entry->dev = server->s_dev;
2288 __entry->status = status;
2289 __assign_str(dstaddr, server->nfs_client->cl_hostname);
2290 memcpy(__entry->deviceid, deviceid->data,
2291 NFS4_DEVICEID4_SIZE);
2292 ),
2293
2294 TP_printk(
2295 "dev=%02x:%02x: deviceid=%s, dstaddr=%s, status=%d",
2296 MAJOR(__entry->dev), MINOR(__entry->dev),
2297 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
2298 __get_str(dstaddr),
2299 __entry->status
2300 )
2301);
2302#define DEFINE_PNFS_DEVICEID_STATUS(name) \
2303 DEFINE_EVENT(nfs4_deviceid_status, name, \
2304 TP_PROTO(const struct nfs_server *server, \
2305 const struct nfs4_deviceid *deviceid, \
2306 int status \
2307 ), \
2308 TP_ARGS(server, deviceid, status))
2309DEFINE_PNFS_DEVICEID_STATUS(nfs4_getdeviceinfo);
2310DEFINE_PNFS_DEVICEID_STATUS(nfs4_find_deviceid);
2311
Trond Myklebust088f3e62020-01-06 15:25:11 -05002312DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
2313 TP_PROTO(
2314 const struct nfs_pgio_header *hdr
2315 ),
2316
2317 TP_ARGS(hdr),
2318
2319 TP_STRUCT__entry(
2320 __field(unsigned long, error)
2321 __field(dev_t, dev)
2322 __field(u32, fhandle)
2323 __field(u64, fileid)
2324 __field(loff_t, offset)
2325 __field(u32, count)
2326 __field(int, stateid_seq)
2327 __field(u32, stateid_hash)
2328 __string(dstaddr, hdr->ds_clp ?
2329 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2330 RPC_DISPLAY_ADDR) : "unknown")
2331 ),
2332
2333 TP_fast_assign(
2334 const struct inode *inode = hdr->inode;
2335
2336 __entry->error = hdr->res.op_status;
2337 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
2338 __entry->fileid = NFS_FILEID(inode);
2339 __entry->dev = inode->i_sb->s_dev;
2340 __entry->offset = hdr->args.offset;
2341 __entry->count = hdr->args.count;
2342 __entry->stateid_seq =
2343 be32_to_cpu(hdr->args.stateid.seqid);
2344 __entry->stateid_hash =
2345 nfs_stateid_hash(&hdr->args.stateid);
2346 __assign_str(dstaddr, hdr->ds_clp ?
2347 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2348 RPC_DISPLAY_ADDR) : "unknown");
2349 ),
2350
2351 TP_printk(
2352 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2353 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
2354 -__entry->error,
2355 show_nfsv4_errors(__entry->error),
2356 MAJOR(__entry->dev), MINOR(__entry->dev),
2357 (unsigned long long)__entry->fileid,
2358 __entry->fhandle,
2359 __entry->offset, __entry->count,
2360 __entry->stateid_seq, __entry->stateid_hash,
2361 __get_str(dstaddr)
2362 )
2363);
2364
2365#define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
2366 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
2367 TP_PROTO( \
2368 const struct nfs_pgio_header *hdr \
2369 ), \
2370 TP_ARGS(hdr))
2371DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
2372DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
2373
2374TRACE_EVENT(ff_layout_commit_error,
2375 TP_PROTO(
2376 const struct nfs_commit_data *data
2377 ),
2378
2379 TP_ARGS(data),
2380
2381 TP_STRUCT__entry(
2382 __field(unsigned long, error)
2383 __field(dev_t, dev)
2384 __field(u32, fhandle)
2385 __field(u64, fileid)
2386 __field(loff_t, offset)
2387 __field(u32, count)
2388 __string(dstaddr, data->ds_clp ?
2389 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2390 RPC_DISPLAY_ADDR) : "unknown")
2391 ),
2392
2393 TP_fast_assign(
2394 const struct inode *inode = data->inode;
2395
2396 __entry->error = data->res.op_status;
2397 __entry->fhandle = nfs_fhandle_hash(data->args.fh);
2398 __entry->fileid = NFS_FILEID(inode);
2399 __entry->dev = inode->i_sb->s_dev;
2400 __entry->offset = data->args.offset;
2401 __entry->count = data->args.count;
2402 __assign_str(dstaddr, data->ds_clp ?
2403 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2404 RPC_DISPLAY_ADDR) : "unknown");
2405 ),
2406
2407 TP_printk(
2408 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2409 "offset=%llu count=%u dstaddr=%s",
2410 -__entry->error,
2411 show_nfsv4_errors(__entry->error),
2412 MAJOR(__entry->dev), MINOR(__entry->dev),
2413 (unsigned long long)__entry->fileid,
2414 __entry->fhandle,
2415 __entry->offset, __entry->count,
2416 __get_str(dstaddr)
2417 )
2418);
2419
2420
Trond Myklebustcc668ab2013-08-14 15:31:28 -04002421#endif /* CONFIG_NFS_V4_1 */
2422
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002423#endif /* _TRACE_NFS4_H */
2424
2425#undef TRACE_INCLUDE_PATH
2426#define TRACE_INCLUDE_PATH .
2427#define TRACE_INCLUDE_FILE nfs4trace
2428/* This part must be outside protection */
2429#include <trace/define_trace.h>