blob: 424d9cd4c19654ce24af3f2e87129cf44400d826 [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>
Chuck Leverb4776a32021-10-16 18:02:24 -040012#include <trace/events/sunrpc_base.h>
Trond Myklebustc6d01c62013-08-09 11:51:26 -040013
Chuck Lever9d2d48b2021-10-22 16:16:56 -040014#include <trace/events/fs.h>
15
Chuck Lever5b2095d2018-12-19 11:00:11 -050016TRACE_DEFINE_ENUM(EPERM);
17TRACE_DEFINE_ENUM(ENOENT);
18TRACE_DEFINE_ENUM(EIO);
19TRACE_DEFINE_ENUM(ENXIO);
20TRACE_DEFINE_ENUM(EACCES);
21TRACE_DEFINE_ENUM(EEXIST);
22TRACE_DEFINE_ENUM(EXDEV);
23TRACE_DEFINE_ENUM(ENOTDIR);
24TRACE_DEFINE_ENUM(EISDIR);
25TRACE_DEFINE_ENUM(EFBIG);
26TRACE_DEFINE_ENUM(ENOSPC);
27TRACE_DEFINE_ENUM(EROFS);
28TRACE_DEFINE_ENUM(EMLINK);
29TRACE_DEFINE_ENUM(ENAMETOOLONG);
30TRACE_DEFINE_ENUM(ENOTEMPTY);
31TRACE_DEFINE_ENUM(EDQUOT);
32TRACE_DEFINE_ENUM(ESTALE);
33TRACE_DEFINE_ENUM(EBADHANDLE);
34TRACE_DEFINE_ENUM(EBADCOOKIE);
35TRACE_DEFINE_ENUM(ENOTSUPP);
36TRACE_DEFINE_ENUM(ETOOSMALL);
37TRACE_DEFINE_ENUM(EREMOTEIO);
38TRACE_DEFINE_ENUM(EBADTYPE);
39TRACE_DEFINE_ENUM(EAGAIN);
40TRACE_DEFINE_ENUM(ELOOP);
41TRACE_DEFINE_ENUM(EOPNOTSUPP);
42TRACE_DEFINE_ENUM(EDEADLK);
43TRACE_DEFINE_ENUM(ENOMEM);
44TRACE_DEFINE_ENUM(EKEYEXPIRED);
45TRACE_DEFINE_ENUM(ETIMEDOUT);
46TRACE_DEFINE_ENUM(ERESTARTSYS);
47TRACE_DEFINE_ENUM(ECONNREFUSED);
48TRACE_DEFINE_ENUM(ECONNRESET);
49TRACE_DEFINE_ENUM(ENETUNREACH);
50TRACE_DEFINE_ENUM(EHOSTUNREACH);
51TRACE_DEFINE_ENUM(EHOSTDOWN);
52TRACE_DEFINE_ENUM(EPIPE);
53TRACE_DEFINE_ENUM(EPFNOSUPPORT);
54TRACE_DEFINE_ENUM(EPROTONOSUPPORT);
55
56TRACE_DEFINE_ENUM(NFS4_OK);
57TRACE_DEFINE_ENUM(NFS4ERR_ACCESS);
58TRACE_DEFINE_ENUM(NFS4ERR_ATTRNOTSUPP);
59TRACE_DEFINE_ENUM(NFS4ERR_ADMIN_REVOKED);
60TRACE_DEFINE_ENUM(NFS4ERR_BACK_CHAN_BUSY);
61TRACE_DEFINE_ENUM(NFS4ERR_BADCHAR);
62TRACE_DEFINE_ENUM(NFS4ERR_BADHANDLE);
63TRACE_DEFINE_ENUM(NFS4ERR_BADIOMODE);
64TRACE_DEFINE_ENUM(NFS4ERR_BADLAYOUT);
65TRACE_DEFINE_ENUM(NFS4ERR_BADLABEL);
66TRACE_DEFINE_ENUM(NFS4ERR_BADNAME);
67TRACE_DEFINE_ENUM(NFS4ERR_BADOWNER);
68TRACE_DEFINE_ENUM(NFS4ERR_BADSESSION);
69TRACE_DEFINE_ENUM(NFS4ERR_BADSLOT);
70TRACE_DEFINE_ENUM(NFS4ERR_BADTYPE);
71TRACE_DEFINE_ENUM(NFS4ERR_BADXDR);
72TRACE_DEFINE_ENUM(NFS4ERR_BAD_COOKIE);
73TRACE_DEFINE_ENUM(NFS4ERR_BAD_HIGH_SLOT);
74TRACE_DEFINE_ENUM(NFS4ERR_BAD_RANGE);
75TRACE_DEFINE_ENUM(NFS4ERR_BAD_SEQID);
76TRACE_DEFINE_ENUM(NFS4ERR_BAD_SESSION_DIGEST);
77TRACE_DEFINE_ENUM(NFS4ERR_BAD_STATEID);
78TRACE_DEFINE_ENUM(NFS4ERR_CB_PATH_DOWN);
79TRACE_DEFINE_ENUM(NFS4ERR_CLID_INUSE);
80TRACE_DEFINE_ENUM(NFS4ERR_CLIENTID_BUSY);
81TRACE_DEFINE_ENUM(NFS4ERR_COMPLETE_ALREADY);
82TRACE_DEFINE_ENUM(NFS4ERR_CONN_NOT_BOUND_TO_SESSION);
83TRACE_DEFINE_ENUM(NFS4ERR_DEADLOCK);
84TRACE_DEFINE_ENUM(NFS4ERR_DEADSESSION);
85TRACE_DEFINE_ENUM(NFS4ERR_DELAY);
86TRACE_DEFINE_ENUM(NFS4ERR_DELEG_ALREADY_WANTED);
87TRACE_DEFINE_ENUM(NFS4ERR_DELEG_REVOKED);
88TRACE_DEFINE_ENUM(NFS4ERR_DENIED);
89TRACE_DEFINE_ENUM(NFS4ERR_DIRDELEG_UNAVAIL);
90TRACE_DEFINE_ENUM(NFS4ERR_DQUOT);
91TRACE_DEFINE_ENUM(NFS4ERR_ENCR_ALG_UNSUPP);
92TRACE_DEFINE_ENUM(NFS4ERR_EXIST);
93TRACE_DEFINE_ENUM(NFS4ERR_EXPIRED);
94TRACE_DEFINE_ENUM(NFS4ERR_FBIG);
95TRACE_DEFINE_ENUM(NFS4ERR_FHEXPIRED);
96TRACE_DEFINE_ENUM(NFS4ERR_FILE_OPEN);
97TRACE_DEFINE_ENUM(NFS4ERR_GRACE);
98TRACE_DEFINE_ENUM(NFS4ERR_HASH_ALG_UNSUPP);
99TRACE_DEFINE_ENUM(NFS4ERR_INVAL);
100TRACE_DEFINE_ENUM(NFS4ERR_IO);
101TRACE_DEFINE_ENUM(NFS4ERR_ISDIR);
102TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTTRYLATER);
103TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTUNAVAILABLE);
104TRACE_DEFINE_ENUM(NFS4ERR_LEASE_MOVED);
105TRACE_DEFINE_ENUM(NFS4ERR_LOCKED);
106TRACE_DEFINE_ENUM(NFS4ERR_LOCKS_HELD);
107TRACE_DEFINE_ENUM(NFS4ERR_LOCK_RANGE);
108TRACE_DEFINE_ENUM(NFS4ERR_MINOR_VERS_MISMATCH);
109TRACE_DEFINE_ENUM(NFS4ERR_MLINK);
110TRACE_DEFINE_ENUM(NFS4ERR_MOVED);
111TRACE_DEFINE_ENUM(NFS4ERR_NAMETOOLONG);
112TRACE_DEFINE_ENUM(NFS4ERR_NOENT);
113TRACE_DEFINE_ENUM(NFS4ERR_NOFILEHANDLE);
114TRACE_DEFINE_ENUM(NFS4ERR_NOMATCHING_LAYOUT);
115TRACE_DEFINE_ENUM(NFS4ERR_NOSPC);
116TRACE_DEFINE_ENUM(NFS4ERR_NOTDIR);
117TRACE_DEFINE_ENUM(NFS4ERR_NOTEMPTY);
118TRACE_DEFINE_ENUM(NFS4ERR_NOTSUPP);
119TRACE_DEFINE_ENUM(NFS4ERR_NOT_ONLY_OP);
120TRACE_DEFINE_ENUM(NFS4ERR_NOT_SAME);
121TRACE_DEFINE_ENUM(NFS4ERR_NO_GRACE);
122TRACE_DEFINE_ENUM(NFS4ERR_NXIO);
123TRACE_DEFINE_ENUM(NFS4ERR_OLD_STATEID);
124TRACE_DEFINE_ENUM(NFS4ERR_OPENMODE);
125TRACE_DEFINE_ENUM(NFS4ERR_OP_ILLEGAL);
126TRACE_DEFINE_ENUM(NFS4ERR_OP_NOT_IN_SESSION);
127TRACE_DEFINE_ENUM(NFS4ERR_PERM);
128TRACE_DEFINE_ENUM(NFS4ERR_PNFS_IO_HOLE);
129TRACE_DEFINE_ENUM(NFS4ERR_PNFS_NO_LAYOUT);
130TRACE_DEFINE_ENUM(NFS4ERR_RECALLCONFLICT);
131TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_BAD);
132TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_CONFLICT);
133TRACE_DEFINE_ENUM(NFS4ERR_REJECT_DELEG);
134TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG);
135TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG_TO_CACHE);
136TRACE_DEFINE_ENUM(NFS4ERR_REQ_TOO_BIG);
137TRACE_DEFINE_ENUM(NFS4ERR_RESOURCE);
138TRACE_DEFINE_ENUM(NFS4ERR_RESTOREFH);
139TRACE_DEFINE_ENUM(NFS4ERR_RETRY_UNCACHED_REP);
140TRACE_DEFINE_ENUM(NFS4ERR_RETURNCONFLICT);
141TRACE_DEFINE_ENUM(NFS4ERR_ROFS);
142TRACE_DEFINE_ENUM(NFS4ERR_SAME);
143TRACE_DEFINE_ENUM(NFS4ERR_SHARE_DENIED);
144TRACE_DEFINE_ENUM(NFS4ERR_SEQUENCE_POS);
145TRACE_DEFINE_ENUM(NFS4ERR_SEQ_FALSE_RETRY);
146TRACE_DEFINE_ENUM(NFS4ERR_SEQ_MISORDERED);
147TRACE_DEFINE_ENUM(NFS4ERR_SERVERFAULT);
148TRACE_DEFINE_ENUM(NFS4ERR_STALE);
149TRACE_DEFINE_ENUM(NFS4ERR_STALE_CLIENTID);
150TRACE_DEFINE_ENUM(NFS4ERR_STALE_STATEID);
151TRACE_DEFINE_ENUM(NFS4ERR_SYMLINK);
152TRACE_DEFINE_ENUM(NFS4ERR_TOOSMALL);
153TRACE_DEFINE_ENUM(NFS4ERR_TOO_MANY_OPS);
154TRACE_DEFINE_ENUM(NFS4ERR_UNKNOWN_LAYOUTTYPE);
155TRACE_DEFINE_ENUM(NFS4ERR_UNSAFE_COMPOUND);
156TRACE_DEFINE_ENUM(NFS4ERR_WRONGSEC);
157TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED);
158TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE);
159TRACE_DEFINE_ENUM(NFS4ERR_XDEV);
160
Trond Myklebust0722dc92020-01-06 15:25:07 -0500161TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_MDS);
162TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_PNFS);
163
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400164#define show_nfsv4_errors(error) \
Chuck Lever96650e22019-06-19 10:33:53 -0400165 __print_symbolic(error, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400166 { NFS4_OK, "OK" }, \
167 /* Mapped by nfs4_stat_to_errno() */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500168 { EPERM, "EPERM" }, \
169 { ENOENT, "ENOENT" }, \
170 { EIO, "EIO" }, \
171 { ENXIO, "ENXIO" }, \
172 { EACCES, "EACCES" }, \
173 { EEXIST, "EEXIST" }, \
174 { EXDEV, "EXDEV" }, \
175 { ENOTDIR, "ENOTDIR" }, \
176 { EISDIR, "EISDIR" }, \
177 { EFBIG, "EFBIG" }, \
178 { ENOSPC, "ENOSPC" }, \
179 { EROFS, "EROFS" }, \
180 { EMLINK, "EMLINK" }, \
181 { ENAMETOOLONG, "ENAMETOOLONG" }, \
182 { ENOTEMPTY, "ENOTEMPTY" }, \
183 { EDQUOT, "EDQUOT" }, \
184 { ESTALE, "ESTALE" }, \
185 { EBADHANDLE, "EBADHANDLE" }, \
186 { EBADCOOKIE, "EBADCOOKIE" }, \
187 { ENOTSUPP, "ENOTSUPP" }, \
188 { ETOOSMALL, "ETOOSMALL" }, \
189 { EREMOTEIO, "EREMOTEIO" }, \
190 { EBADTYPE, "EBADTYPE" }, \
191 { EAGAIN, "EAGAIN" }, \
192 { ELOOP, "ELOOP" }, \
193 { EOPNOTSUPP, "EOPNOTSUPP" }, \
194 { EDEADLK, "EDEADLK" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400195 /* RPC errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500196 { ENOMEM, "ENOMEM" }, \
197 { EKEYEXPIRED, "EKEYEXPIRED" }, \
198 { ETIMEDOUT, "ETIMEDOUT" }, \
199 { ERESTARTSYS, "ERESTARTSYS" }, \
200 { ECONNREFUSED, "ECONNREFUSED" }, \
201 { ECONNRESET, "ECONNRESET" }, \
202 { ENETUNREACH, "ENETUNREACH" }, \
203 { EHOSTUNREACH, "EHOSTUNREACH" }, \
204 { EHOSTDOWN, "EHOSTDOWN" }, \
205 { EPIPE, "EPIPE" }, \
206 { EPFNOSUPPORT, "EPFNOSUPPORT" }, \
207 { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400208 /* NFSv4 native errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500209 { NFS4ERR_ACCESS, "ACCESS" }, \
210 { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
211 { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
212 { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
213 { NFS4ERR_BADCHAR, "BADCHAR" }, \
214 { NFS4ERR_BADHANDLE, "BADHANDLE" }, \
215 { NFS4ERR_BADIOMODE, "BADIOMODE" }, \
216 { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
217 { NFS4ERR_BADLABEL, "BADLABEL" }, \
218 { NFS4ERR_BADNAME, "BADNAME" }, \
219 { NFS4ERR_BADOWNER, "BADOWNER" }, \
220 { NFS4ERR_BADSESSION, "BADSESSION" }, \
221 { NFS4ERR_BADSLOT, "BADSLOT" }, \
222 { NFS4ERR_BADTYPE, "BADTYPE" }, \
223 { NFS4ERR_BADXDR, "BADXDR" }, \
224 { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
225 { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
226 { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
227 { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
228 { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
229 { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
230 { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
231 { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
232 { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
233 { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
234 { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400235 "CONN_NOT_BOUND_TO_SESSION" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500236 { NFS4ERR_DEADLOCK, "DEADLOCK" }, \
237 { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
238 { NFS4ERR_DELAY, "DELAY" }, \
239 { NFS4ERR_DELEG_ALREADY_WANTED, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400240 "DELEG_ALREADY_WANTED" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500241 { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
242 { NFS4ERR_DENIED, "DENIED" }, \
243 { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
244 { NFS4ERR_DQUOT, "DQUOT" }, \
245 { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
246 { NFS4ERR_EXIST, "EXIST" }, \
247 { NFS4ERR_EXPIRED, "EXPIRED" }, \
248 { NFS4ERR_FBIG, "FBIG" }, \
249 { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
250 { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
251 { NFS4ERR_GRACE, "GRACE" }, \
252 { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
253 { NFS4ERR_INVAL, "INVAL" }, \
254 { NFS4ERR_IO, "IO" }, \
255 { NFS4ERR_ISDIR, "ISDIR" }, \
256 { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
257 { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
258 { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
259 { NFS4ERR_LOCKED, "LOCKED" }, \
260 { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
261 { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
262 { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
263 { NFS4ERR_MLINK, "MLINK" }, \
264 { NFS4ERR_MOVED, "MOVED" }, \
265 { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
266 { NFS4ERR_NOENT, "NOENT" }, \
267 { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
268 { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
269 { NFS4ERR_NOSPC, "NOSPC" }, \
270 { NFS4ERR_NOTDIR, "NOTDIR" }, \
271 { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
272 { NFS4ERR_NOTSUPP, "NOTSUPP" }, \
273 { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
274 { NFS4ERR_NOT_SAME, "NOT_SAME" }, \
275 { NFS4ERR_NO_GRACE, "NO_GRACE" }, \
276 { NFS4ERR_NXIO, "NXIO" }, \
277 { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
278 { NFS4ERR_OPENMODE, "OPENMODE" }, \
279 { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
280 { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
281 { NFS4ERR_PERM, "PERM" }, \
282 { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
283 { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
284 { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
285 { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
286 { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
287 { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
288 { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
289 { NFS4ERR_REP_TOO_BIG_TO_CACHE, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400290 "REP_TOO_BIG_TO_CACHE" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500291 { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
292 { NFS4ERR_RESOURCE, "RESOURCE" }, \
293 { NFS4ERR_RESTOREFH, "RESTOREFH" }, \
294 { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
295 { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
296 { NFS4ERR_ROFS, "ROFS" }, \
297 { NFS4ERR_SAME, "SAME" }, \
298 { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
299 { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
300 { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
301 { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
302 { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
303 { NFS4ERR_STALE, "STALE" }, \
304 { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
305 { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
306 { NFS4ERR_SYMLINK, "SYMLINK" }, \
307 { NFS4ERR_TOOSMALL, "TOOSMALL" }, \
308 { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
309 { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
310 { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
311 { NFS4ERR_WRONGSEC, "WRONGSEC" }, \
312 { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
313 { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
Trond Myklebust0722dc92020-01-06 15:25:07 -0500314 { NFS4ERR_XDEV, "XDEV" }, \
315 /* ***** Internal to Linux NFS client ***** */ \
316 { NFS4ERR_RESET_TO_MDS, "RESET_TO_MDS" }, \
317 { NFS4ERR_RESET_TO_PNFS, "RESET_TO_PNFS" })
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400318
Trond Myklebustb5f875a2013-08-13 13:01:39 -0400319#define show_nfs_fattr_flags(valid) \
320 __print_flags((unsigned long)valid, "|", \
321 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
322 { NFS_ATTR_FATTR_MODE, "MODE" }, \
323 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
324 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
325 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
326 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
327 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
328 { NFS_ATTR_FATTR_FSID, "FSID" }, \
329 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
330 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
331 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
332 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
333 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
334 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
335 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
336
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400337DECLARE_EVENT_CLASS(nfs4_clientid_event,
338 TP_PROTO(
339 const struct nfs_client *clp,
340 int error
341 ),
342
343 TP_ARGS(clp, error),
344
345 TP_STRUCT__entry(
Anna Schumaker39443692017-11-01 15:48:43 -0400346 __string(dstaddr, clp->cl_hostname)
Chuck Lever96650e22019-06-19 10:33:53 -0400347 __field(unsigned long, error)
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400348 ),
349
350 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -0500351 __entry->error = error < 0 ? -error : 0;
Anna Schumaker39443692017-11-01 15:48:43 -0400352 __assign_str(dstaddr, clp->cl_hostname);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400353 ),
354
355 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400356 "error=%ld (%s) dstaddr=%s",
357 -__entry->error,
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400358 show_nfsv4_errors(__entry->error),
359 __get_str(dstaddr)
360 )
361);
362#define DEFINE_NFS4_CLIENTID_EVENT(name) \
363 DEFINE_EVENT(nfs4_clientid_event, name, \
364 TP_PROTO( \
365 const struct nfs_client *clp, \
366 int error \
367 ), \
368 TP_ARGS(clp, error))
369DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
370DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
371DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
372DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
373#ifdef CONFIG_NFS_V4_1
374DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
375DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
376DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
377DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
378DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
379DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
380DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400381
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400382#define show_nfs4_sequence_status_flags(status) \
383 __print_flags((unsigned long)status, "|", \
384 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
385 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
386 "CB_GSS_CONTEXTS_EXPIRING" }, \
387 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
388 "CB_GSS_CONTEXTS_EXPIRED" }, \
389 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
390 "EXPIRED_ALL_STATE_REVOKED" }, \
391 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
392 "EXPIRED_SOME_STATE_REVOKED" }, \
393 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
394 "ADMIN_STATE_REVOKED" }, \
395 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
396 "RECALLABLE_STATE_REVOKED" }, \
397 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
398 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
399 "RESTART_RECLAIM_NEEDED" }, \
400 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
401 "CB_PATH_DOWN_SESSION" }, \
402 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
403 "BACKCHANNEL_FAULT" })
404
405TRACE_EVENT(nfs4_sequence_done,
406 TP_PROTO(
407 const struct nfs4_session *session,
408 const struct nfs4_sequence_res *res
409 ),
410 TP_ARGS(session, res),
411
412 TP_STRUCT__entry(
413 __field(unsigned int, session)
414 __field(unsigned int, slot_nr)
415 __field(unsigned int, seq_nr)
416 __field(unsigned int, highest_slotid)
417 __field(unsigned int, target_highest_slotid)
418 __field(unsigned int, status_flags)
Chuck Lever96650e22019-06-19 10:33:53 -0400419 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400420 ),
421
422 TP_fast_assign(
423 const struct nfs4_slot *sr_slot = res->sr_slot;
424 __entry->session = nfs_session_id_hash(&session->sess_id);
425 __entry->slot_nr = sr_slot->slot_nr;
426 __entry->seq_nr = sr_slot->seq_nr;
427 __entry->highest_slotid = res->sr_highest_slotid;
428 __entry->target_highest_slotid =
429 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500430 __entry->status_flags = res->sr_status_flags;
Trond Myklebust118b6292020-01-06 15:25:06 -0500431 __entry->error = res->sr_status < 0 ?
432 -res->sr_status : 0;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400433 ),
434 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400435 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400436 "highest_slotid=%u target_highest_slotid=%u "
437 "status_flags=%u (%s)",
Chuck Lever96650e22019-06-19 10:33:53 -0400438 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400439 show_nfsv4_errors(__entry->error),
440 __entry->session,
441 __entry->slot_nr,
442 __entry->seq_nr,
443 __entry->highest_slotid,
444 __entry->target_highest_slotid,
445 __entry->status_flags,
446 show_nfs4_sequence_status_flags(__entry->status_flags)
447 )
448);
449
450struct cb_sequenceargs;
451struct cb_sequenceres;
452
453TRACE_EVENT(nfs4_cb_sequence,
454 TP_PROTO(
455 const struct cb_sequenceargs *args,
456 const struct cb_sequenceres *res,
457 __be32 status
458 ),
459 TP_ARGS(args, res, status),
460
461 TP_STRUCT__entry(
462 __field(unsigned int, session)
463 __field(unsigned int, slot_nr)
464 __field(unsigned int, seq_nr)
465 __field(unsigned int, highest_slotid)
466 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400467 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400468 ),
469
470 TP_fast_assign(
471 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
472 __entry->slot_nr = args->csa_slotid;
473 __entry->seq_nr = args->csa_sequenceid;
474 __entry->highest_slotid = args->csa_highestslotid;
475 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400476 __entry->error = be32_to_cpu(status);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400477 ),
478
479 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400480 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400481 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400482 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400483 show_nfsv4_errors(__entry->error),
484 __entry->session,
485 __entry->slot_nr,
486 __entry->seq_nr,
487 __entry->highest_slotid
488 )
489);
Chuck Leverc5833f02019-06-19 10:33:47 -0400490
491TRACE_EVENT(nfs4_cb_seqid_err,
492 TP_PROTO(
493 const struct cb_sequenceargs *args,
494 __be32 status
495 ),
496 TP_ARGS(args, status),
497
498 TP_STRUCT__entry(
499 __field(unsigned int, session)
500 __field(unsigned int, slot_nr)
501 __field(unsigned int, seq_nr)
502 __field(unsigned int, highest_slotid)
503 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400504 __field(unsigned long, error)
Chuck Leverc5833f02019-06-19 10:33:47 -0400505 ),
506
507 TP_fast_assign(
508 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
509 __entry->slot_nr = args->csa_slotid;
510 __entry->seq_nr = args->csa_sequenceid;
511 __entry->highest_slotid = args->csa_highestslotid;
512 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400513 __entry->error = be32_to_cpu(status);
Chuck Leverc5833f02019-06-19 10:33:47 -0400514 ),
515
516 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400517 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Chuck Leverc5833f02019-06-19 10:33:47 -0400518 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400519 -__entry->error,
Chuck Leverc5833f02019-06-19 10:33:47 -0400520 show_nfsv4_errors(__entry->error),
521 __entry->session,
522 __entry->slot_nr,
523 __entry->seq_nr,
524 __entry->highest_slotid
525 )
526);
527
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400528#endif /* CONFIG_NFS_V4_1 */
529
Anna Schumakerad05cc02017-01-11 13:37:06 -0500530TRACE_EVENT(nfs4_setup_sequence,
531 TP_PROTO(
532 const struct nfs4_session *session,
533 const struct nfs4_sequence_args *args
534 ),
535 TP_ARGS(session, args),
536
537 TP_STRUCT__entry(
538 __field(unsigned int, session)
539 __field(unsigned int, slot_nr)
540 __field(unsigned int, seq_nr)
541 __field(unsigned int, highest_used_slotid)
542 ),
543
544 TP_fast_assign(
545 const struct nfs4_slot *sa_slot = args->sa_slot;
546 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
547 __entry->slot_nr = sa_slot->slot_nr;
548 __entry->seq_nr = sa_slot->seq_nr;
549 __entry->highest_used_slotid =
550 sa_slot->table->highest_used_slotid;
551 ),
552 TP_printk(
553 "session=0x%08x slot_nr=%u seq_nr=%u "
554 "highest_used_slotid=%u",
555 __entry->session,
556 __entry->slot_nr,
557 __entry->seq_nr,
558 __entry->highest_used_slotid
559 )
560);
561
Chuck Lever511ba522019-11-05 11:04:07 -0500562TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
563TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
564TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
565TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
566TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
567TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
568TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
569TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
570TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
571TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
572TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
573TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
574TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
575TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
576TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
Trond Myklebustb5fdf842020-02-18 15:58:31 -0500577TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_RUNNING);
578TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ);
579TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW);
Chuck Lever511ba522019-11-05 11:04:07 -0500580
581#define show_nfs4_clp_state(state) \
582 __print_flags(state, "|", \
583 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \
584 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \
585 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \
586 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
587 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
588 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \
589 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \
590 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \
591 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \
592 "SERVER_SCOPE_MISMATCH" }, \
593 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \
594 { NFS4CLNT_BIND_CONN_TO_SESSION, \
595 "BIND_CONN_TO_SESSION" }, \
596 { NFS4CLNT_MOVED, "MOVED" }, \
597 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \
598 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \
599 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \
Trond Myklebustb5fdf842020-02-18 15:58:31 -0500600 { NFS4CLNT_RECALL_RUNNING, "RECALL_RUNNING" }, \
601 { NFS4CLNT_RECALL_ANY_LAYOUT_READ, "RECALL_ANY_LAYOUT_READ" }, \
602 { NFS4CLNT_RECALL_ANY_LAYOUT_RW, "RECALL_ANY_LAYOUT_RW" })
Chuck Lever511ba522019-11-05 11:04:07 -0500603
604TRACE_EVENT(nfs4_state_mgr,
605 TP_PROTO(
606 const struct nfs_client *clp
607 ),
608
609 TP_ARGS(clp),
610
611 TP_STRUCT__entry(
612 __field(unsigned long, state)
613 __string(hostname, clp->cl_hostname)
614 ),
615
616 TP_fast_assign(
617 __entry->state = clp->cl_state;
Joe Perches78c14b32021-06-12 08:42:27 -0700618 __assign_str(hostname, clp->cl_hostname);
Chuck Lever511ba522019-11-05 11:04:07 -0500619 ),
620
621 TP_printk(
622 "hostname=%s clp state=%s", __get_str(hostname),
623 show_nfs4_clp_state(__entry->state)
624 )
625)
626
627TRACE_EVENT(nfs4_state_mgr_failed,
628 TP_PROTO(
629 const struct nfs_client *clp,
630 const char *section,
631 int status
632 ),
633
634 TP_ARGS(clp, section, status),
635
636 TP_STRUCT__entry(
637 __field(unsigned long, error)
638 __field(unsigned long, state)
639 __string(hostname, clp->cl_hostname)
640 __string(section, section)
641 ),
642
643 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -0500644 __entry->error = status < 0 ? -status : 0;
Chuck Lever511ba522019-11-05 11:04:07 -0500645 __entry->state = clp->cl_state;
646 __assign_str(hostname, clp->cl_hostname);
647 __assign_str(section, section);
648 ),
649
650 TP_printk(
651 "hostname=%s clp state=%s error=%ld (%s) section=%s",
652 __get_str(hostname),
653 show_nfs4_clp_state(__entry->state), -__entry->error,
654 show_nfsv4_errors(__entry->error), __get_str(section)
655
656 )
657)
658
Trond Myklebustda934ae2021-04-01 14:38:13 -0400659TRACE_EVENT(nfs4_xdr_bad_operation,
660 TP_PROTO(
661 const struct xdr_stream *xdr,
662 u32 op,
663 u32 expected
664 ),
665
666 TP_ARGS(xdr, op, expected),
667
668 TP_STRUCT__entry(
669 __field(unsigned int, task_id)
670 __field(unsigned int, client_id)
671 __field(u32, xid)
672 __field(u32, op)
673 __field(u32, expected)
674 ),
675
676 TP_fast_assign(
677 const struct rpc_rqst *rqstp = xdr->rqst;
678 const struct rpc_task *task = rqstp->rq_task;
679
680 __entry->task_id = task->tk_pid;
681 __entry->client_id = task->tk_client->cl_clid;
682 __entry->xid = be32_to_cpu(rqstp->rq_xid);
683 __entry->op = op;
684 __entry->expected = expected;
685 ),
686
Chuck Leverb4776a32021-10-16 18:02:24 -0400687 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
688 " xid=0x%08x operation=%u, expected=%u",
Trond Myklebustda934ae2021-04-01 14:38:13 -0400689 __entry->task_id, __entry->client_id, __entry->xid,
690 __entry->op, __entry->expected
691 )
692);
693
Trond Myklebust3d66bae2021-04-01 13:54:19 -0400694DECLARE_EVENT_CLASS(nfs4_xdr_event,
Chuck Leverf23f6582019-02-11 11:24:26 -0500695 TP_PROTO(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400696 const struct xdr_stream *xdr,
Chuck Leverf23f6582019-02-11 11:24:26 -0500697 u32 op,
Trond Myklebust118b6292020-01-06 15:25:06 -0500698 u32 error
Chuck Leverf23f6582019-02-11 11:24:26 -0500699 ),
700
Chuck Lever62a92ba2019-06-19 10:34:09 -0400701 TP_ARGS(xdr, op, error),
Chuck Leverf23f6582019-02-11 11:24:26 -0500702
703 TP_STRUCT__entry(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400704 __field(unsigned int, task_id)
705 __field(unsigned int, client_id)
706 __field(u32, xid)
Chuck Leverf23f6582019-02-11 11:24:26 -0500707 __field(u32, op)
Chuck Lever96650e22019-06-19 10:33:53 -0400708 __field(unsigned long, error)
Chuck Leverf23f6582019-02-11 11:24:26 -0500709 ),
710
711 TP_fast_assign(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400712 const struct rpc_rqst *rqstp = xdr->rqst;
713 const struct rpc_task *task = rqstp->rq_task;
714
715 __entry->task_id = task->tk_pid;
716 __entry->client_id = task->tk_client->cl_clid;
717 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Leverf23f6582019-02-11 11:24:26 -0500718 __entry->op = op;
Chuck Lever96650e22019-06-19 10:33:53 -0400719 __entry->error = error;
Chuck Leverf23f6582019-02-11 11:24:26 -0500720 ),
721
Chuck Leverb4776a32021-10-16 18:02:24 -0400722 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
723 " xid=0x%08x error=%ld (%s) operation=%u",
Chuck Lever62a92ba2019-06-19 10:34:09 -0400724 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever96650e22019-06-19 10:33:53 -0400725 -__entry->error, show_nfsv4_errors(__entry->error),
726 __entry->op
Chuck Leverf23f6582019-02-11 11:24:26 -0500727 )
728);
Trond Myklebust3d66bae2021-04-01 13:54:19 -0400729#define DEFINE_NFS4_XDR_EVENT(name) \
730 DEFINE_EVENT(nfs4_xdr_event, name, \
731 TP_PROTO( \
732 const struct xdr_stream *xdr, \
733 u32 op, \
734 u32 error \
735 ), \
736 TP_ARGS(xdr, op, error))
737DEFINE_NFS4_XDR_EVENT(nfs4_xdr_status);
Trond Myklebusteb3d58c2021-04-01 14:03:26 -0400738DEFINE_NFS4_XDR_EVENT(nfs4_xdr_bad_filehandle);
Chuck Leverf23f6582019-02-11 11:24:26 -0500739
Chuck Lever2bb50aa2019-12-23 10:28:38 -0500740DECLARE_EVENT_CLASS(nfs4_cb_error_class,
741 TP_PROTO(
742 __be32 xid,
743 u32 cb_ident
744 ),
745
746 TP_ARGS(xid, cb_ident),
747
748 TP_STRUCT__entry(
749 __field(u32, xid)
750 __field(u32, cbident)
751 ),
752
753 TP_fast_assign(
754 __entry->xid = be32_to_cpu(xid);
755 __entry->cbident = cb_ident;
756 ),
757
758 TP_printk(
759 "xid=0x%08x cb_ident=0x%08x",
760 __entry->xid, __entry->cbident
761 )
762);
763
764#define DEFINE_CB_ERROR_EVENT(name) \
765 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
766 TP_PROTO( \
767 __be32 xid, \
768 u32 cb_ident \
769 ), \
770 TP_ARGS(xid, cb_ident))
771
772DEFINE_CB_ERROR_EVENT(no_clp);
773DEFINE_CB_ERROR_EVENT(badprinc);
774
Trond Myklebust42113a72013-08-12 16:19:27 -0400775DECLARE_EVENT_CLASS(nfs4_open_event,
776 TP_PROTO(
777 const struct nfs_open_context *ctx,
778 int flags,
779 int error
780 ),
781
782 TP_ARGS(ctx, flags, error),
783
784 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400785 __field(unsigned long, error)
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400786 __field(unsigned long, flags)
787 __field(unsigned long, fmode)
Trond Myklebust42113a72013-08-12 16:19:27 -0400788 __field(dev_t, dev)
789 __field(u32, fhandle)
790 __field(u64, fileid)
791 __field(u64, dir)
792 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500793 __field(int, stateid_seq)
794 __field(u32, stateid_hash)
795 __field(int, openstateid_seq)
796 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400797 ),
798
799 TP_fast_assign(
800 const struct nfs4_state *state = ctx->state;
801 const struct inode *inode = NULL;
802
Chuck Lever96650e22019-06-19 10:33:53 -0400803 __entry->error = -error;
Trond Myklebust42113a72013-08-12 16:19:27 -0400804 __entry->flags = flags;
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400805 __entry->fmode = (__force unsigned long)ctx->mode;
Trond Myklebust42113a72013-08-12 16:19:27 -0400806 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500807 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400808 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500809 __entry->stateid_seq =
810 be32_to_cpu(state->stateid.seqid);
811 __entry->stateid_hash =
812 nfs_stateid_hash(&state->stateid);
813 __entry->openstateid_seq =
814 be32_to_cpu(state->open_stateid.seqid);
815 __entry->openstateid_hash =
816 nfs_stateid_hash(&state->open_stateid);
817 } else {
818 __entry->stateid_seq = 0;
819 __entry->stateid_hash = 0;
820 __entry->openstateid_seq = 0;
821 __entry->openstateid_hash = 0;
822 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400823 if (inode != NULL) {
824 __entry->fileid = NFS_FILEID(inode);
825 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
826 } else {
827 __entry->fileid = 0;
828 __entry->fhandle = 0;
829 }
David Howells2b0143b2015-03-17 22:25:59 +0000830 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400831 __assign_str(name, ctx->dentry->d_name.name);
832 ),
833
834 TP_printk(
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400835 "error=%ld (%s) flags=%lu (%s) fmode=%s "
Trond Myklebust42113a72013-08-12 16:19:27 -0400836 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500837 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
838 "openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400839 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400840 show_nfsv4_errors(__entry->error),
841 __entry->flags,
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400842 show_fs_fcntl_open_flags(__entry->flags),
843 show_fs_fmode_flags(__entry->fmode),
Trond Myklebust42113a72013-08-12 16:19:27 -0400844 MAJOR(__entry->dev), MINOR(__entry->dev),
845 (unsigned long long)__entry->fileid,
846 __entry->fhandle,
847 MAJOR(__entry->dev), MINOR(__entry->dev),
848 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500849 __get_str(name),
850 __entry->stateid_seq, __entry->stateid_hash,
851 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400852 )
853);
854
855#define DEFINE_NFS4_OPEN_EVENT(name) \
856 DEFINE_EVENT(nfs4_open_event, name, \
857 TP_PROTO( \
858 const struct nfs_open_context *ctx, \
859 int flags, \
860 int error \
861 ), \
862 TP_ARGS(ctx, flags, error))
863DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
864DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
865DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
866
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500867TRACE_EVENT(nfs4_cached_open,
868 TP_PROTO(
869 const struct nfs4_state *state
870 ),
871 TP_ARGS(state),
872 TP_STRUCT__entry(
873 __field(dev_t, dev)
874 __field(u32, fhandle)
875 __field(u64, fileid)
876 __field(unsigned int, fmode)
877 __field(int, stateid_seq)
878 __field(u32, stateid_hash)
879 ),
880
881 TP_fast_assign(
882 const struct inode *inode = state->inode;
883
884 __entry->dev = inode->i_sb->s_dev;
885 __entry->fileid = NFS_FILEID(inode);
886 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
887 __entry->fmode = (__force unsigned int)state->state;
888 __entry->stateid_seq =
889 be32_to_cpu(state->stateid.seqid);
890 __entry->stateid_hash =
891 nfs_stateid_hash(&state->stateid);
892 ),
893
894 TP_printk(
895 "fmode=%s fileid=%02x:%02x:%llu "
896 "fhandle=0x%08x stateid=%d:0x%08x",
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400897 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) :
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500898 "closed",
899 MAJOR(__entry->dev), MINOR(__entry->dev),
900 (unsigned long long)__entry->fileid,
901 __entry->fhandle,
902 __entry->stateid_seq, __entry->stateid_hash
903 )
904);
905
Trond Myklebust42113a72013-08-12 16:19:27 -0400906TRACE_EVENT(nfs4_close,
907 TP_PROTO(
908 const struct nfs4_state *state,
909 const struct nfs_closeargs *args,
910 const struct nfs_closeres *res,
911 int error
912 ),
913
914 TP_ARGS(state, args, res, error),
915
916 TP_STRUCT__entry(
917 __field(dev_t, dev)
918 __field(u32, fhandle)
919 __field(u64, fileid)
920 __field(unsigned int, fmode)
Chuck Lever96650e22019-06-19 10:33:53 -0400921 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500922 __field(int, stateid_seq)
923 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400924 ),
925
926 TP_fast_assign(
927 const struct inode *inode = state->inode;
928
929 __entry->dev = inode->i_sb->s_dev;
930 __entry->fileid = NFS_FILEID(inode);
931 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
932 __entry->fmode = (__force unsigned int)state->state;
Trond Myklebust118b6292020-01-06 15:25:06 -0500933 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500934 __entry->stateid_seq =
935 be32_to_cpu(args->stateid.seqid);
936 __entry->stateid_hash =
937 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400938 ),
939
940 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400941 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500942 "fhandle=0x%08x openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400943 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400944 show_nfsv4_errors(__entry->error),
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400945 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) :
Trond Myklebust42113a72013-08-12 16:19:27 -0400946 "closed",
947 MAJOR(__entry->dev), MINOR(__entry->dev),
948 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500949 __entry->fhandle,
950 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400951 )
952);
953
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400954DECLARE_EVENT_CLASS(nfs4_lock_event,
955 TP_PROTO(
956 const struct file_lock *request,
957 const struct nfs4_state *state,
958 int cmd,
959 int error
960 ),
961
962 TP_ARGS(request, state, cmd, error),
963
964 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400965 __field(unsigned long, error)
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400966 __field(unsigned long, cmd)
967 __field(unsigned long, type)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400968 __field(loff_t, start)
969 __field(loff_t, end)
970 __field(dev_t, dev)
971 __field(u32, fhandle)
972 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500973 __field(int, stateid_seq)
974 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400975 ),
976
977 TP_fast_assign(
978 const struct inode *inode = state->inode;
979
Trond Myklebust118b6292020-01-06 15:25:06 -0500980 __entry->error = error < 0 ? -error : 0;
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400981 __entry->cmd = cmd;
982 __entry->type = request->fl_type;
983 __entry->start = request->fl_start;
984 __entry->end = request->fl_end;
985 __entry->dev = inode->i_sb->s_dev;
986 __entry->fileid = NFS_FILEID(inode);
987 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500988 __entry->stateid_seq =
989 be32_to_cpu(state->stateid.seqid);
990 __entry->stateid_hash =
991 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400992 ),
993
994 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400995 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500996 "fileid=%02x:%02x:%llu fhandle=0x%08x "
997 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400998 -__entry->error,
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400999 show_nfsv4_errors(__entry->error),
Chuck Lever9d2d48b2021-10-22 16:16:56 -04001000 show_fs_fcntl_cmd(__entry->cmd),
1001 show_fs_fcntl_lock_type(__entry->type),
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001002 (long long)__entry->start,
1003 (long long)__entry->end,
1004 MAJOR(__entry->dev), MINOR(__entry->dev),
1005 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001006 __entry->fhandle,
1007 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001008 )
1009);
1010
1011#define DEFINE_NFS4_LOCK_EVENT(name) \
1012 DEFINE_EVENT(nfs4_lock_event, name, \
1013 TP_PROTO( \
1014 const struct file_lock *request, \
1015 const struct nfs4_state *state, \
1016 int cmd, \
1017 int error \
1018 ), \
1019 TP_ARGS(request, state, cmd, error))
1020DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001021DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
1022
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001023TRACE_EVENT(nfs4_set_lock,
1024 TP_PROTO(
1025 const struct file_lock *request,
1026 const struct nfs4_state *state,
1027 const nfs4_stateid *lockstateid,
1028 int cmd,
1029 int error
1030 ),
1031
1032 TP_ARGS(request, state, lockstateid, cmd, error),
1033
1034 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001035 __field(unsigned long, error)
Chuck Lever9d2d48b2021-10-22 16:16:56 -04001036 __field(unsigned long, cmd)
1037 __field(unsigned long, type)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001038 __field(loff_t, start)
1039 __field(loff_t, end)
1040 __field(dev_t, dev)
1041 __field(u32, fhandle)
1042 __field(u64, fileid)
1043 __field(int, stateid_seq)
1044 __field(u32, stateid_hash)
1045 __field(int, lockstateid_seq)
1046 __field(u32, lockstateid_hash)
1047 ),
1048
1049 TP_fast_assign(
1050 const struct inode *inode = state->inode;
1051
Trond Myklebust118b6292020-01-06 15:25:06 -05001052 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001053 __entry->cmd = cmd;
1054 __entry->type = request->fl_type;
1055 __entry->start = request->fl_start;
1056 __entry->end = request->fl_end;
1057 __entry->dev = inode->i_sb->s_dev;
1058 __entry->fileid = NFS_FILEID(inode);
1059 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1060 __entry->stateid_seq =
1061 be32_to_cpu(state->stateid.seqid);
1062 __entry->stateid_hash =
1063 nfs_stateid_hash(&state->stateid);
1064 __entry->lockstateid_seq =
1065 be32_to_cpu(lockstateid->seqid);
1066 __entry->lockstateid_hash =
1067 nfs_stateid_hash(lockstateid);
1068 ),
1069
1070 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001071 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001072 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1073 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001074 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001075 show_nfsv4_errors(__entry->error),
Chuck Lever9d2d48b2021-10-22 16:16:56 -04001076 show_fs_fcntl_cmd(__entry->cmd),
1077 show_fs_fcntl_lock_type(__entry->type),
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001078 (long long)__entry->start,
1079 (long long)__entry->end,
1080 MAJOR(__entry->dev), MINOR(__entry->dev),
1081 (unsigned long long)__entry->fileid,
1082 __entry->fhandle,
1083 __entry->stateid_seq, __entry->stateid_hash,
1084 __entry->lockstateid_seq, __entry->lockstateid_hash
1085 )
1086);
1087
Chuck Lever21f86d22019-11-05 11:04:13 -05001088TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
1089TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
1090TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
1091TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
1092TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
1093TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
1094TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
1095TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
1096TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
1097TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
1098TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
1099TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
1100TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
1101TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
1102TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
1103
1104#define show_nfs4_state_flags(flags) \
1105 __print_flags(flags, "|", \
1106 { LK_STATE_IN_USE, "IN_USE" }, \
1107 { NFS_DELEGATED_STATE, "DELEGATED" }, \
1108 { NFS_OPEN_STATE, "OPEN" }, \
1109 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
1110 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
1111 { NFS_O_RDWR_STATE, "O_RDWR" }, \
1112 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
1113 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
1114 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
1115 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
1116 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
1117 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
1118 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
1119 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
1120 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
1121
1122#define show_nfs4_lock_flags(flags) \
1123 __print_flags(flags, "|", \
1124 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
1125 { BIT(NFS_LOCK_LOST), "LOST" })
1126
1127TRACE_EVENT(nfs4_state_lock_reclaim,
1128 TP_PROTO(
1129 const struct nfs4_state *state,
1130 const struct nfs4_lock_state *lock
1131 ),
1132
1133 TP_ARGS(state, lock),
1134
1135 TP_STRUCT__entry(
1136 __field(dev_t, dev)
1137 __field(u32, fhandle)
1138 __field(u64, fileid)
1139 __field(unsigned long, state_flags)
1140 __field(unsigned long, lock_flags)
1141 __field(int, stateid_seq)
1142 __field(u32, stateid_hash)
1143 ),
1144
1145 TP_fast_assign(
1146 const struct inode *inode = state->inode;
1147
1148 __entry->dev = inode->i_sb->s_dev;
1149 __entry->fileid = NFS_FILEID(inode);
1150 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1151 __entry->state_flags = state->flags;
1152 __entry->lock_flags = lock->ls_flags;
1153 __entry->stateid_seq =
1154 be32_to_cpu(state->stateid.seqid);
1155 __entry->stateid_hash =
1156 nfs_stateid_hash(&state->stateid);
1157 ),
1158
1159 TP_printk(
1160 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1161 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
1162 MAJOR(__entry->dev), MINOR(__entry->dev),
1163 (unsigned long long)__entry->fileid, __entry->fhandle,
1164 __entry->stateid_seq, __entry->stateid_hash,
1165 show_nfs4_state_flags(__entry->state_flags),
1166 show_nfs4_lock_flags(__entry->lock_flags)
1167 )
1168)
1169
Trond Myklebustca8acf82013-08-13 10:36:56 -04001170DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
1171 TP_PROTO(
1172 const struct inode *inode,
1173 fmode_t fmode
1174 ),
1175
1176 TP_ARGS(inode, fmode),
1177
1178 TP_STRUCT__entry(
1179 __field(dev_t, dev)
1180 __field(u32, fhandle)
1181 __field(u64, fileid)
1182 __field(unsigned int, fmode)
1183 ),
1184
1185 TP_fast_assign(
1186 __entry->dev = inode->i_sb->s_dev;
1187 __entry->fileid = NFS_FILEID(inode);
1188 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1189 __entry->fmode = (__force unsigned int)fmode;
1190 ),
1191
1192 TP_printk(
1193 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
Chuck Lever9d2d48b2021-10-22 16:16:56 -04001194 show_fs_fmode_flags(__entry->fmode),
Trond Myklebustca8acf82013-08-13 10:36:56 -04001195 MAJOR(__entry->dev), MINOR(__entry->dev),
1196 (unsigned long long)__entry->fileid,
1197 __entry->fhandle
1198 )
1199);
1200#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
1201 DEFINE_EVENT(nfs4_set_delegation_event, name, \
1202 TP_PROTO( \
1203 const struct inode *inode, \
1204 fmode_t fmode \
1205 ), \
1206 TP_ARGS(inode, fmode))
1207DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
1208DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
1209
1210TRACE_EVENT(nfs4_delegreturn_exit,
1211 TP_PROTO(
1212 const struct nfs4_delegreturnargs *args,
1213 const struct nfs4_delegreturnres *res,
1214 int error
1215 ),
1216
1217 TP_ARGS(args, res, error),
1218
1219 TP_STRUCT__entry(
1220 __field(dev_t, dev)
1221 __field(u32, fhandle)
Chuck Lever96650e22019-06-19 10:33:53 -04001222 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001223 __field(int, stateid_seq)
1224 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -04001225 ),
1226
1227 TP_fast_assign(
1228 __entry->dev = res->server->s_dev;
1229 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
Trond Myklebust118b6292020-01-06 15:25:06 -05001230 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001231 __entry->stateid_seq =
1232 be32_to_cpu(args->stateid->seqid);
1233 __entry->stateid_hash =
1234 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -04001235 ),
1236
1237 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001238 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001239 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001240 -__entry->error,
Trond Myklebustca8acf82013-08-13 10:36:56 -04001241 show_nfsv4_errors(__entry->error),
1242 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001243 __entry->fhandle,
1244 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -04001245 )
1246);
1247
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001248#ifdef CONFIG_NFS_V4_1
1249DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
1250 TP_PROTO(
1251 const struct nfs4_state *state,
1252 const struct nfs4_lock_state *lsp,
1253 int error
1254 ),
1255
1256 TP_ARGS(state, lsp, error),
1257
1258 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001259 __field(unsigned long, error)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001260 __field(dev_t, dev)
1261 __field(u32, fhandle)
1262 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001263 __field(int, stateid_seq)
1264 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001265 ),
1266
1267 TP_fast_assign(
1268 const struct inode *inode = state->inode;
1269
Trond Myklebust118b6292020-01-06 15:25:06 -05001270 __entry->error = error < 0 ? -error : 0;
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001271 __entry->dev = inode->i_sb->s_dev;
1272 __entry->fileid = NFS_FILEID(inode);
1273 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001274 __entry->stateid_seq =
1275 be32_to_cpu(state->stateid.seqid);
1276 __entry->stateid_hash =
1277 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001278 ),
1279
1280 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001281 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001282 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001283 -__entry->error,
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001284 show_nfsv4_errors(__entry->error),
1285 MAJOR(__entry->dev), MINOR(__entry->dev),
1286 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001287 __entry->fhandle,
1288 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001289 )
1290);
1291
1292#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1293 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1294 TP_PROTO( \
1295 const struct nfs4_state *state, \
1296 const struct nfs4_lock_state *lsp, \
1297 int error \
1298 ), \
1299 TP_ARGS(state, lsp, error))
1300DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1301DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1302DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1303#endif /* CONFIG_NFS_V4_1 */
1304
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001305DECLARE_EVENT_CLASS(nfs4_lookup_event,
1306 TP_PROTO(
1307 const struct inode *dir,
1308 const struct qstr *name,
1309 int error
1310 ),
1311
1312 TP_ARGS(dir, name, error),
1313
1314 TP_STRUCT__entry(
1315 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001316 __field(unsigned long, error)
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001317 __field(u64, dir)
1318 __string(name, name->name)
1319 ),
1320
1321 TP_fast_assign(
1322 __entry->dev = dir->i_sb->s_dev;
1323 __entry->dir = NFS_FILEID(dir);
Chuck Lever96650e22019-06-19 10:33:53 -04001324 __entry->error = -error;
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001325 __assign_str(name, name->name);
1326 ),
1327
1328 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001329 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1330 -__entry->error,
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001331 show_nfsv4_errors(__entry->error),
1332 MAJOR(__entry->dev), MINOR(__entry->dev),
1333 (unsigned long long)__entry->dir,
1334 __get_str(name)
1335 )
1336);
1337
1338#define DEFINE_NFS4_LOOKUP_EVENT(name) \
1339 DEFINE_EVENT(nfs4_lookup_event, name, \
1340 TP_PROTO( \
1341 const struct inode *dir, \
1342 const struct qstr *name, \
1343 int error \
1344 ), \
1345 TP_ARGS(dir, name, error))
1346
1347DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1348DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1349DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1350DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1351DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1352DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1353DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1354
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001355TRACE_EVENT(nfs4_lookupp,
1356 TP_PROTO(
1357 const struct inode *inode,
1358 int error
1359 ),
1360
1361 TP_ARGS(inode, error),
1362
1363 TP_STRUCT__entry(
1364 __field(dev_t, dev)
1365 __field(u64, ino)
Chuck Lever96650e22019-06-19 10:33:53 -04001366 __field(unsigned long, error)
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001367 ),
1368
1369 TP_fast_assign(
1370 __entry->dev = inode->i_sb->s_dev;
1371 __entry->ino = NFS_FILEID(inode);
Trond Myklebust118b6292020-01-06 15:25:06 -05001372 __entry->error = error < 0 ? -error : 0;
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001373 ),
1374
1375 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001376 "error=%ld (%s) inode=%02x:%02x:%llu",
1377 -__entry->error,
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001378 show_nfsv4_errors(__entry->error),
1379 MAJOR(__entry->dev), MINOR(__entry->dev),
1380 (unsigned long long)__entry->ino
1381 )
1382);
1383
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001384TRACE_EVENT(nfs4_rename,
1385 TP_PROTO(
1386 const struct inode *olddir,
1387 const struct qstr *oldname,
1388 const struct inode *newdir,
1389 const struct qstr *newname,
1390 int error
1391 ),
1392
1393 TP_ARGS(olddir, oldname, newdir, newname, error),
1394
1395 TP_STRUCT__entry(
1396 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001397 __field(unsigned long, error)
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001398 __field(u64, olddir)
1399 __string(oldname, oldname->name)
1400 __field(u64, newdir)
1401 __string(newname, newname->name)
1402 ),
1403
1404 TP_fast_assign(
1405 __entry->dev = olddir->i_sb->s_dev;
1406 __entry->olddir = NFS_FILEID(olddir);
1407 __entry->newdir = NFS_FILEID(newdir);
Trond Myklebust118b6292020-01-06 15:25:06 -05001408 __entry->error = error < 0 ? -error : 0;
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001409 __assign_str(oldname, oldname->name);
1410 __assign_str(newname, newname->name);
1411 ),
1412
1413 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001414 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001415 "newname=%02x:%02x:%llu/%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001416 -__entry->error,
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001417 show_nfsv4_errors(__entry->error),
1418 MAJOR(__entry->dev), MINOR(__entry->dev),
1419 (unsigned long long)__entry->olddir,
1420 __get_str(oldname),
1421 MAJOR(__entry->dev), MINOR(__entry->dev),
1422 (unsigned long long)__entry->newdir,
1423 __get_str(newname)
1424 )
1425);
1426
Trond Myklebustc1578b72013-08-12 16:58:42 -04001427DECLARE_EVENT_CLASS(nfs4_inode_event,
1428 TP_PROTO(
1429 const struct inode *inode,
1430 int error
1431 ),
1432
1433 TP_ARGS(inode, error),
1434
1435 TP_STRUCT__entry(
1436 __field(dev_t, dev)
1437 __field(u32, fhandle)
1438 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001439 __field(unsigned long, error)
Trond Myklebustc1578b72013-08-12 16:58:42 -04001440 ),
1441
1442 TP_fast_assign(
1443 __entry->dev = inode->i_sb->s_dev;
1444 __entry->fileid = NFS_FILEID(inode);
1445 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Chuck Lever96650e22019-06-19 10:33:53 -04001446 __entry->error = error < 0 ? -error : 0;
Trond Myklebustc1578b72013-08-12 16:58:42 -04001447 ),
1448
1449 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001450 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1451 -__entry->error,
Trond Myklebustc1578b72013-08-12 16:58:42 -04001452 show_nfsv4_errors(__entry->error),
1453 MAJOR(__entry->dev), MINOR(__entry->dev),
1454 (unsigned long long)__entry->fileid,
1455 __entry->fhandle
1456 )
1457);
1458
1459#define DEFINE_NFS4_INODE_EVENT(name) \
1460 DEFINE_EVENT(nfs4_inode_event, name, \
1461 TP_PROTO( \
1462 const struct inode *inode, \
1463 int error \
1464 ), \
1465 TP_ARGS(inode, error))
1466
Trond Myklebustc1578b72013-08-12 16:58:42 -04001467DEFINE_NFS4_INODE_EVENT(nfs4_access);
1468DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1469DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1470DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1471DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1472#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1473DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1474DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1475#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001476
1477DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1478 TP_PROTO(
1479 const struct inode *inode,
1480 const nfs4_stateid *stateid,
1481 int error
1482 ),
1483
1484 TP_ARGS(inode, stateid, error),
1485
1486 TP_STRUCT__entry(
1487 __field(dev_t, dev)
1488 __field(u32, fhandle)
1489 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001490 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001491 __field(int, stateid_seq)
1492 __field(u32, stateid_hash)
1493 ),
1494
1495 TP_fast_assign(
1496 __entry->dev = inode->i_sb->s_dev;
1497 __entry->fileid = NFS_FILEID(inode);
1498 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Trond Myklebust118b6292020-01-06 15:25:06 -05001499 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001500 __entry->stateid_seq =
1501 be32_to_cpu(stateid->seqid);
1502 __entry->stateid_hash =
1503 nfs_stateid_hash(stateid);
1504 ),
1505
1506 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001507 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001508 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001509 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001510 show_nfsv4_errors(__entry->error),
1511 MAJOR(__entry->dev), MINOR(__entry->dev),
1512 (unsigned long long)__entry->fileid,
1513 __entry->fhandle,
1514 __entry->stateid_seq, __entry->stateid_hash
1515 )
1516);
1517
1518#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1519 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1520 TP_PROTO( \
1521 const struct inode *inode, \
1522 const nfs4_stateid *stateid, \
1523 int error \
1524 ), \
1525 TP_ARGS(inode, stateid, error))
1526
1527DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1528DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustad9e02d2017-11-06 15:28:02 -05001529DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1530DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
Benjamin Coddingtonb4868b42020-09-25 15:48:39 -04001531DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001532
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001533DECLARE_EVENT_CLASS(nfs4_getattr_event,
1534 TP_PROTO(
1535 const struct nfs_server *server,
1536 const struct nfs_fh *fhandle,
1537 const struct nfs_fattr *fattr,
1538 int error
1539 ),
1540
1541 TP_ARGS(server, fhandle, fattr, error),
1542
1543 TP_STRUCT__entry(
1544 __field(dev_t, dev)
1545 __field(u32, fhandle)
1546 __field(u64, fileid)
1547 __field(unsigned int, valid)
Chuck Lever96650e22019-06-19 10:33:53 -04001548 __field(unsigned long, error)
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001549 ),
1550
1551 TP_fast_assign(
1552 __entry->dev = server->s_dev;
1553 __entry->valid = fattr->valid;
1554 __entry->fhandle = nfs_fhandle_hash(fhandle);
1555 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
Trond Myklebust118b6292020-01-06 15:25:06 -05001556 __entry->error = error < 0 ? -error : 0;
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001557 ),
1558
1559 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001560 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001561 "valid=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001562 -__entry->error,
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001563 show_nfsv4_errors(__entry->error),
1564 MAJOR(__entry->dev), MINOR(__entry->dev),
1565 (unsigned long long)__entry->fileid,
1566 __entry->fhandle,
1567 show_nfs_fattr_flags(__entry->valid)
1568 )
1569);
1570
1571#define DEFINE_NFS4_GETATTR_EVENT(name) \
1572 DEFINE_EVENT(nfs4_getattr_event, name, \
1573 TP_PROTO( \
1574 const struct nfs_server *server, \
1575 const struct nfs_fh *fhandle, \
1576 const struct nfs_fattr *fattr, \
1577 int error \
1578 ), \
1579 TP_ARGS(server, fhandle, fattr, error))
1580DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1581DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1582DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1583
Trond Myklebust7cd14862015-08-20 20:07:54 -05001584DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1585 TP_PROTO(
1586 const struct nfs_client *clp,
1587 const struct nfs_fh *fhandle,
1588 const struct inode *inode,
1589 int error
1590 ),
1591
1592 TP_ARGS(clp, fhandle, inode, error),
1593
1594 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001595 __field(unsigned long, error)
Trond Myklebust7cd14862015-08-20 20:07:54 -05001596 __field(dev_t, dev)
1597 __field(u32, fhandle)
1598 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001599 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001600 ),
1601
1602 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001603 __entry->error = error < 0 ? -error : 0;
Trond Myklebust7cd14862015-08-20 20:07:54 -05001604 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2edaead2018-09-05 14:07:13 -04001605 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebust7cd14862015-08-20 20:07:54 -05001606 __entry->fileid = NFS_FILEID(inode);
1607 __entry->dev = inode->i_sb->s_dev;
1608 } else {
1609 __entry->fileid = 0;
1610 __entry->dev = 0;
1611 }
Joe Perches78c14b32021-06-12 08:42:27 -07001612 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown");
Trond Myklebust7cd14862015-08-20 20:07:54 -05001613 ),
1614
1615 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001616 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7cd14862015-08-20 20:07:54 -05001617 "dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001618 -__entry->error,
Trond Myklebust7cd14862015-08-20 20:07:54 -05001619 show_nfsv4_errors(__entry->error),
1620 MAJOR(__entry->dev), MINOR(__entry->dev),
1621 (unsigned long long)__entry->fileid,
1622 __entry->fhandle,
1623 __get_str(dstaddr)
1624 )
1625);
1626
1627#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1628 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1629 TP_PROTO( \
1630 const struct nfs_client *clp, \
1631 const struct nfs_fh *fhandle, \
1632 const struct inode *inode, \
1633 int error \
1634 ), \
1635 TP_ARGS(clp, fhandle, inode, error))
1636DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1637
Trond Myklebuste07db902015-12-28 14:07:23 -05001638DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1639 TP_PROTO(
1640 const struct nfs_client *clp,
1641 const struct nfs_fh *fhandle,
1642 const struct inode *inode,
1643 const nfs4_stateid *stateid,
1644 int error
1645 ),
1646
1647 TP_ARGS(clp, fhandle, inode, stateid, error),
1648
1649 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001650 __field(unsigned long, error)
Trond Myklebuste07db902015-12-28 14:07:23 -05001651 __field(dev_t, dev)
1652 __field(u32, fhandle)
1653 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001654 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001655 __field(int, stateid_seq)
1656 __field(u32, stateid_hash)
1657 ),
1658
1659 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001660 __entry->error = error < 0 ? -error : 0;
Trond Myklebuste07db902015-12-28 14:07:23 -05001661 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2a534a72018-08-23 11:02:49 -04001662 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebuste07db902015-12-28 14:07:23 -05001663 __entry->fileid = NFS_FILEID(inode);
1664 __entry->dev = inode->i_sb->s_dev;
1665 } else {
1666 __entry->fileid = 0;
1667 __entry->dev = 0;
1668 }
Joe Perches78c14b32021-06-12 08:42:27 -07001669 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown");
Trond Myklebuste07db902015-12-28 14:07:23 -05001670 __entry->stateid_seq =
1671 be32_to_cpu(stateid->seqid);
1672 __entry->stateid_hash =
1673 nfs_stateid_hash(stateid);
1674 ),
1675
1676 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001677 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebuste07db902015-12-28 14:07:23 -05001678 "stateid=%d:0x%08x dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001679 -__entry->error,
Trond Myklebuste07db902015-12-28 14:07:23 -05001680 show_nfsv4_errors(__entry->error),
1681 MAJOR(__entry->dev), MINOR(__entry->dev),
1682 (unsigned long long)__entry->fileid,
1683 __entry->fhandle,
1684 __entry->stateid_seq, __entry->stateid_hash,
1685 __get_str(dstaddr)
1686 )
1687);
1688
1689#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1690 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1691 TP_PROTO( \
1692 const struct nfs_client *clp, \
1693 const struct nfs_fh *fhandle, \
1694 const struct inode *inode, \
1695 const nfs4_stateid *stateid, \
1696 int error \
1697 ), \
1698 TP_ARGS(clp, fhandle, inode, stateid, error))
1699DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1700DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001701
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001702DECLARE_EVENT_CLASS(nfs4_idmap_event,
1703 TP_PROTO(
1704 const char *name,
1705 int len,
1706 u32 id,
1707 int error
1708 ),
1709
1710 TP_ARGS(name, len, id, error),
1711
1712 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001713 __field(unsigned long, error)
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001714 __field(u32, id)
1715 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1716 ),
1717
1718 TP_fast_assign(
1719 if (len < 0)
1720 len = 0;
1721 __entry->error = error < 0 ? error : 0;
1722 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001723 memcpy(__get_str(name), name, len);
1724 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001725 ),
1726
1727 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001728 "error=%ld (%s) id=%u name=%s",
1729 -__entry->error, show_nfsv4_errors(__entry->error),
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001730 __entry->id,
1731 __get_str(name)
1732 )
1733);
1734#define DEFINE_NFS4_IDMAP_EVENT(name) \
1735 DEFINE_EVENT(nfs4_idmap_event, name, \
1736 TP_PROTO( \
1737 const char *name, \
1738 int len, \
1739 u32 id, \
1740 int error \
1741 ), \
1742 TP_ARGS(name, len, id, error))
1743DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1744DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1745DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1746DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1747
Trond Myklebust54898f72020-08-04 22:16:06 -04001748#ifdef CONFIG_NFS_V4_1
1749#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
1750 (lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
1751#else
1752#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
1753#endif
1754
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001755DECLARE_EVENT_CLASS(nfs4_read_event,
1756 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001757 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001758 int error
1759 ),
1760
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001761 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001762
1763 TP_STRUCT__entry(
1764 __field(dev_t, dev)
1765 __field(u32, fhandle)
1766 __field(u64, fileid)
1767 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001768 __field(u32, arg_count)
1769 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001770 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001771 __field(int, stateid_seq)
1772 __field(u32, stateid_hash)
Trond Myklebust54898f72020-08-04 22:16:06 -04001773 __field(int, layoutstateid_seq)
1774 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001775 ),
1776
1777 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001778 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001779 const struct nfs_inode *nfsi = NFS_I(inode);
1780 const struct nfs_fh *fh = hdr->args.fh ?
1781 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001782 const struct nfs4_state *state =
1783 hdr->args.context->state;
Trond Myklebust54898f72020-08-04 22:16:06 -04001784 const struct pnfs_layout_segment *lseg = hdr->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001785
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001786 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001787 __entry->fileid = nfsi->fileid;
1788 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001789 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001790 __entry->arg_count = hdr->args.count;
1791 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001792 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001793 __entry->stateid_seq =
1794 be32_to_cpu(state->stateid.seqid);
1795 __entry->stateid_hash =
1796 nfs_stateid_hash(&state->stateid);
Trond Myklebust54898f72020-08-04 22:16:06 -04001797 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1798 __entry->layoutstateid_hash =
1799 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001800 ),
1801
1802 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001803 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001804 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1805 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001806 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001807 show_nfsv4_errors(__entry->error),
1808 MAJOR(__entry->dev), MINOR(__entry->dev),
1809 (unsigned long long)__entry->fileid,
1810 __entry->fhandle,
1811 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001812 __entry->arg_count, __entry->res_count,
Trond Myklebust54898f72020-08-04 22:16:06 -04001813 __entry->stateid_seq, __entry->stateid_hash,
1814 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001815 )
1816);
1817#define DEFINE_NFS4_READ_EVENT(name) \
1818 DEFINE_EVENT(nfs4_read_event, name, \
1819 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001820 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001821 int error \
1822 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001823 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001824DEFINE_NFS4_READ_EVENT(nfs4_read);
1825#ifdef CONFIG_NFS_V4_1
1826DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1827#endif /* CONFIG_NFS_V4_1 */
1828
1829DECLARE_EVENT_CLASS(nfs4_write_event,
1830 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001831 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001832 int error
1833 ),
1834
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001835 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001836
1837 TP_STRUCT__entry(
1838 __field(dev_t, dev)
1839 __field(u32, fhandle)
1840 __field(u64, fileid)
1841 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001842 __field(u32, arg_count)
1843 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001844 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001845 __field(int, stateid_seq)
1846 __field(u32, stateid_hash)
Trond Myklebust54898f72020-08-04 22:16:06 -04001847 __field(int, layoutstateid_seq)
1848 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001849 ),
1850
1851 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001852 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001853 const struct nfs_inode *nfsi = NFS_I(inode);
1854 const struct nfs_fh *fh = hdr->args.fh ?
1855 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001856 const struct nfs4_state *state =
1857 hdr->args.context->state;
Trond Myklebust54898f72020-08-04 22:16:06 -04001858 const struct pnfs_layout_segment *lseg = hdr->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001859
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001860 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001861 __entry->fileid = nfsi->fileid;
1862 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001863 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001864 __entry->arg_count = hdr->args.count;
1865 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001866 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001867 __entry->stateid_seq =
1868 be32_to_cpu(state->stateid.seqid);
1869 __entry->stateid_hash =
1870 nfs_stateid_hash(&state->stateid);
Trond Myklebust54898f72020-08-04 22:16:06 -04001871 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1872 __entry->layoutstateid_hash =
1873 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001874 ),
1875
1876 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001877 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001878 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1879 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001880 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001881 show_nfsv4_errors(__entry->error),
1882 MAJOR(__entry->dev), MINOR(__entry->dev),
1883 (unsigned long long)__entry->fileid,
1884 __entry->fhandle,
1885 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001886 __entry->arg_count, __entry->res_count,
Trond Myklebust54898f72020-08-04 22:16:06 -04001887 __entry->stateid_seq, __entry->stateid_hash,
1888 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001889 )
1890);
1891
1892#define DEFINE_NFS4_WRITE_EVENT(name) \
1893 DEFINE_EVENT(nfs4_write_event, name, \
1894 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001895 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001896 int error \
1897 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001898 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001899DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1900#ifdef CONFIG_NFS_V4_1
1901DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1902#endif /* CONFIG_NFS_V4_1 */
1903
1904DECLARE_EVENT_CLASS(nfs4_commit_event,
1905 TP_PROTO(
1906 const struct nfs_commit_data *data,
1907 int error
1908 ),
1909
1910 TP_ARGS(data, error),
1911
1912 TP_STRUCT__entry(
1913 __field(dev_t, dev)
1914 __field(u32, fhandle)
1915 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001916 __field(unsigned long, error)
Trond Myklebust25925b02020-01-06 15:25:05 -05001917 __field(loff_t, offset)
1918 __field(u32, count)
Trond Myklebust54898f72020-08-04 22:16:06 -04001919 __field(int, layoutstateid_seq)
1920 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001921 ),
1922
1923 TP_fast_assign(
1924 const struct inode *inode = data->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001925 const struct nfs_inode *nfsi = NFS_I(inode);
1926 const struct nfs_fh *fh = data->args.fh ?
1927 data->args.fh : &nfsi->fh;
Trond Myklebust54898f72020-08-04 22:16:06 -04001928 const struct pnfs_layout_segment *lseg = data->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001929
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001930 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001931 __entry->fileid = nfsi->fileid;
1932 __entry->fhandle = nfs_fhandle_hash(fh);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001933 __entry->offset = data->args.offset;
1934 __entry->count = data->args.count;
Trond Myklebust25925b02020-01-06 15:25:05 -05001935 __entry->error = error < 0 ? -error : 0;
Trond Myklebust54898f72020-08-04 22:16:06 -04001936 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1937 __entry->layoutstateid_hash =
1938 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001939 ),
1940
1941 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001942 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001943 "offset=%lld count=%u layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001944 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001945 show_nfsv4_errors(__entry->error),
1946 MAJOR(__entry->dev), MINOR(__entry->dev),
1947 (unsigned long long)__entry->fileid,
1948 __entry->fhandle,
1949 (long long)__entry->offset,
Trond Myklebust54898f72020-08-04 22:16:06 -04001950 __entry->count,
1951 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001952 )
1953);
1954#define DEFINE_NFS4_COMMIT_EVENT(name) \
1955 DEFINE_EVENT(nfs4_commit_event, name, \
1956 TP_PROTO( \
1957 const struct nfs_commit_data *data, \
1958 int error \
1959 ), \
1960 TP_ARGS(data, error))
1961DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1962#ifdef CONFIG_NFS_V4_1
1963DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001964
Chuck Lever5b2095d2018-12-19 11:00:11 -05001965TRACE_DEFINE_ENUM(IOMODE_READ);
1966TRACE_DEFINE_ENUM(IOMODE_RW);
1967TRACE_DEFINE_ENUM(IOMODE_ANY);
1968
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001969#define show_pnfs_iomode(iomode) \
1970 __print_symbolic(iomode, \
1971 { IOMODE_READ, "READ" }, \
1972 { IOMODE_RW, "RW" }, \
1973 { IOMODE_ANY, "ANY" })
1974
1975TRACE_EVENT(nfs4_layoutget,
1976 TP_PROTO(
1977 const struct nfs_open_context *ctx,
1978 const struct pnfs_layout_range *args,
1979 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001980 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001981 int error
1982 ),
1983
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001984 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001985
1986 TP_STRUCT__entry(
1987 __field(dev_t, dev)
1988 __field(u32, fhandle)
1989 __field(u64, fileid)
1990 __field(u32, iomode)
1991 __field(u64, offset)
1992 __field(u64, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001993 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001994 __field(int, stateid_seq)
1995 __field(u32, stateid_hash)
1996 __field(int, layoutstateid_seq)
1997 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001998 ),
1999
2000 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00002001 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002002 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002003 __entry->dev = inode->i_sb->s_dev;
2004 __entry->fileid = NFS_FILEID(inode);
2005 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2006 __entry->iomode = args->iomode;
2007 __entry->offset = args->offset;
2008 __entry->count = args->length;
Trond Myklebust118b6292020-01-06 15:25:06 -05002009 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002010 __entry->stateid_seq =
2011 be32_to_cpu(state->stateid.seqid);
2012 __entry->stateid_hash =
2013 nfs_stateid_hash(&state->stateid);
2014 if (!error) {
2015 __entry->layoutstateid_seq =
2016 be32_to_cpu(layout_stateid->seqid);
2017 __entry->layoutstateid_hash =
2018 nfs_stateid_hash(layout_stateid);
2019 } else {
2020 __entry->layoutstateid_seq = 0;
2021 __entry->layoutstateid_hash = 0;
2022 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002023 ),
2024
2025 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04002026 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002027 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
2028 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04002029 -__entry->error,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002030 show_nfsv4_errors(__entry->error),
2031 MAJOR(__entry->dev), MINOR(__entry->dev),
2032 (unsigned long long)__entry->fileid,
2033 __entry->fhandle,
2034 show_pnfs_iomode(__entry->iomode),
2035 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002036 (unsigned long long)__entry->count,
2037 __entry->stateid_seq, __entry->stateid_hash,
2038 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002039 )
2040);
2041
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002042DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
2043DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebusta19b4782020-08-03 18:32:28 -04002044DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust638037b2020-08-04 11:02:44 -04002045DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror);
2046DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002047
Chuck Lever5b2095d2018-12-19 11:00:11 -05002048TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
2049TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
2050TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
2051TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
2052TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
2053TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
2054TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
2055TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
2056TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
2057TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
2058TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
2059TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
2060TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
Trond Myklebustd5b92162019-07-18 09:32:17 -04002061TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
Chuck Lever5b2095d2018-12-19 11:00:11 -05002062
Jeff Layton9a4bf312015-12-10 10:41:58 -05002063#define show_pnfs_update_layout_reason(reason) \
2064 __print_symbolic(reason, \
2065 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
2066 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
2067 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
2068 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
2069 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
2070 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
2071 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
2072 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
2073 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
2074 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04002075 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
2076 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Trond Myklebustd5b92162019-07-18 09:32:17 -04002077 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
2078 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
Jeff Layton9a4bf312015-12-10 10:41:58 -05002079
2080TRACE_EVENT(pnfs_update_layout,
2081 TP_PROTO(struct inode *inode,
2082 loff_t pos,
2083 u64 count,
2084 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05002085 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04002086 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002087 enum pnfs_update_layout_reason reason
2088 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04002089 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05002090 TP_STRUCT__entry(
2091 __field(dev_t, dev)
2092 __field(u64, fileid)
2093 __field(u32, fhandle)
2094 __field(loff_t, pos)
2095 __field(u64, count)
2096 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05002097 __field(int, layoutstateid_seq)
2098 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04002099 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05002100 __field(enum pnfs_update_layout_reason, reason)
2101 ),
2102 TP_fast_assign(
2103 __entry->dev = inode->i_sb->s_dev;
2104 __entry->fileid = NFS_FILEID(inode);
2105 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2106 __entry->pos = pos;
2107 __entry->count = count;
2108 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002109 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05002110 if (lo != NULL) {
2111 __entry->layoutstateid_seq =
2112 be32_to_cpu(lo->plh_stateid.seqid);
2113 __entry->layoutstateid_hash =
2114 nfs_stateid_hash(&lo->plh_stateid);
2115 } else {
2116 __entry->layoutstateid_seq = 0;
2117 __entry->layoutstateid_hash = 0;
2118 }
Jeff Layton183d9e72016-05-17 12:28:47 -04002119 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002120 ),
2121 TP_printk(
2122 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05002123 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04002124 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05002125 MAJOR(__entry->dev), MINOR(__entry->dev),
2126 (unsigned long long)__entry->fileid,
2127 __entry->fhandle,
2128 show_pnfs_iomode(__entry->iomode),
2129 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05002130 (unsigned long long)__entry->count,
2131 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04002132 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002133 show_pnfs_update_layout_reason(__entry->reason)
2134 )
2135);
2136
Trond Myklebustd5b92162019-07-18 09:32:17 -04002137DECLARE_EVENT_CLASS(pnfs_layout_event,
2138 TP_PROTO(struct inode *inode,
2139 loff_t pos,
2140 u64 count,
2141 enum pnfs_iomode iomode,
2142 struct pnfs_layout_hdr *lo,
2143 struct pnfs_layout_segment *lseg
2144 ),
2145 TP_ARGS(inode, pos, count, iomode, lo, lseg),
2146 TP_STRUCT__entry(
2147 __field(dev_t, dev)
2148 __field(u64, fileid)
2149 __field(u32, fhandle)
2150 __field(loff_t, pos)
2151 __field(u64, count)
2152 __field(enum pnfs_iomode, iomode)
2153 __field(int, layoutstateid_seq)
2154 __field(u32, layoutstateid_hash)
2155 __field(long, lseg)
2156 ),
2157 TP_fast_assign(
2158 __entry->dev = inode->i_sb->s_dev;
2159 __entry->fileid = NFS_FILEID(inode);
2160 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2161 __entry->pos = pos;
2162 __entry->count = count;
2163 __entry->iomode = iomode;
2164 if (lo != NULL) {
2165 __entry->layoutstateid_seq =
2166 be32_to_cpu(lo->plh_stateid.seqid);
2167 __entry->layoutstateid_hash =
2168 nfs_stateid_hash(&lo->plh_stateid);
2169 } else {
2170 __entry->layoutstateid_seq = 0;
2171 __entry->layoutstateid_hash = 0;
2172 }
2173 __entry->lseg = (long)lseg;
2174 ),
2175 TP_printk(
2176 "fileid=%02x:%02x:%llu fhandle=0x%08x "
2177 "iomode=%s pos=%llu count=%llu "
2178 "layoutstateid=%d:0x%08x lseg=0x%lx",
2179 MAJOR(__entry->dev), MINOR(__entry->dev),
2180 (unsigned long long)__entry->fileid,
2181 __entry->fhandle,
2182 show_pnfs_iomode(__entry->iomode),
2183 (unsigned long long)__entry->pos,
2184 (unsigned long long)__entry->count,
2185 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
2186 __entry->lseg
2187 )
2188);
2189
2190#define DEFINE_PNFS_LAYOUT_EVENT(name) \
2191 DEFINE_EVENT(pnfs_layout_event, name, \
2192 TP_PROTO(struct inode *inode, \
2193 loff_t pos, \
2194 u64 count, \
2195 enum pnfs_iomode iomode, \
2196 struct pnfs_layout_hdr *lo, \
2197 struct pnfs_layout_segment *lseg \
2198 ), \
2199 TP_ARGS(inode, pos, count, iomode, lo, lseg))
2200
2201DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
2202DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
2203DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
2204DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
2205DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
2206DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
2207DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
2208
Trond Myklebustcac1d3a2020-12-16 16:31:26 -05002209DECLARE_EVENT_CLASS(nfs4_deviceid_event,
2210 TP_PROTO(
2211 const struct nfs_client *clp,
2212 const struct nfs4_deviceid *deviceid
2213 ),
2214
2215 TP_ARGS(clp, deviceid),
2216
2217 TP_STRUCT__entry(
2218 __string(dstaddr, clp->cl_hostname)
2219 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
2220 ),
2221
2222 TP_fast_assign(
2223 __assign_str(dstaddr, clp->cl_hostname);
2224 memcpy(__entry->deviceid, deviceid->data,
2225 NFS4_DEVICEID4_SIZE);
2226 ),
2227
2228 TP_printk(
2229 "deviceid=%s, dstaddr=%s",
2230 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
2231 __get_str(dstaddr)
2232 )
2233);
2234#define DEFINE_PNFS_DEVICEID_EVENT(name) \
2235 DEFINE_EVENT(nfs4_deviceid_event, name, \
2236 TP_PROTO(const struct nfs_client *clp, \
2237 const struct nfs4_deviceid *deviceid \
2238 ), \
2239 TP_ARGS(clp, deviceid))
2240DEFINE_PNFS_DEVICEID_EVENT(nfs4_deviceid_free);
2241
2242DECLARE_EVENT_CLASS(nfs4_deviceid_status,
2243 TP_PROTO(
2244 const struct nfs_server *server,
2245 const struct nfs4_deviceid *deviceid,
2246 int status
2247 ),
2248
2249 TP_ARGS(server, deviceid, status),
2250
2251 TP_STRUCT__entry(
2252 __field(dev_t, dev)
2253 __field(int, status)
2254 __string(dstaddr, server->nfs_client->cl_hostname)
2255 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
2256 ),
2257
2258 TP_fast_assign(
2259 __entry->dev = server->s_dev;
2260 __entry->status = status;
2261 __assign_str(dstaddr, server->nfs_client->cl_hostname);
2262 memcpy(__entry->deviceid, deviceid->data,
2263 NFS4_DEVICEID4_SIZE);
2264 ),
2265
2266 TP_printk(
2267 "dev=%02x:%02x: deviceid=%s, dstaddr=%s, status=%d",
2268 MAJOR(__entry->dev), MINOR(__entry->dev),
2269 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
2270 __get_str(dstaddr),
2271 __entry->status
2272 )
2273);
2274#define DEFINE_PNFS_DEVICEID_STATUS(name) \
2275 DEFINE_EVENT(nfs4_deviceid_status, name, \
2276 TP_PROTO(const struct nfs_server *server, \
2277 const struct nfs4_deviceid *deviceid, \
2278 int status \
2279 ), \
2280 TP_ARGS(server, deviceid, status))
2281DEFINE_PNFS_DEVICEID_STATUS(nfs4_getdeviceinfo);
2282DEFINE_PNFS_DEVICEID_STATUS(nfs4_find_deviceid);
2283
Trond Myklebust088f3e62020-01-06 15:25:11 -05002284DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
2285 TP_PROTO(
2286 const struct nfs_pgio_header *hdr
2287 ),
2288
2289 TP_ARGS(hdr),
2290
2291 TP_STRUCT__entry(
2292 __field(unsigned long, error)
2293 __field(dev_t, dev)
2294 __field(u32, fhandle)
2295 __field(u64, fileid)
2296 __field(loff_t, offset)
2297 __field(u32, count)
2298 __field(int, stateid_seq)
2299 __field(u32, stateid_hash)
2300 __string(dstaddr, hdr->ds_clp ?
2301 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2302 RPC_DISPLAY_ADDR) : "unknown")
2303 ),
2304
2305 TP_fast_assign(
2306 const struct inode *inode = hdr->inode;
2307
2308 __entry->error = hdr->res.op_status;
2309 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
2310 __entry->fileid = NFS_FILEID(inode);
2311 __entry->dev = inode->i_sb->s_dev;
2312 __entry->offset = hdr->args.offset;
2313 __entry->count = hdr->args.count;
2314 __entry->stateid_seq =
2315 be32_to_cpu(hdr->args.stateid.seqid);
2316 __entry->stateid_hash =
2317 nfs_stateid_hash(&hdr->args.stateid);
2318 __assign_str(dstaddr, hdr->ds_clp ?
2319 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2320 RPC_DISPLAY_ADDR) : "unknown");
2321 ),
2322
2323 TP_printk(
2324 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2325 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
2326 -__entry->error,
2327 show_nfsv4_errors(__entry->error),
2328 MAJOR(__entry->dev), MINOR(__entry->dev),
2329 (unsigned long long)__entry->fileid,
2330 __entry->fhandle,
2331 __entry->offset, __entry->count,
2332 __entry->stateid_seq, __entry->stateid_hash,
2333 __get_str(dstaddr)
2334 )
2335);
2336
2337#define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
2338 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
2339 TP_PROTO( \
2340 const struct nfs_pgio_header *hdr \
2341 ), \
2342 TP_ARGS(hdr))
2343DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
2344DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
2345
2346TRACE_EVENT(ff_layout_commit_error,
2347 TP_PROTO(
2348 const struct nfs_commit_data *data
2349 ),
2350
2351 TP_ARGS(data),
2352
2353 TP_STRUCT__entry(
2354 __field(unsigned long, error)
2355 __field(dev_t, dev)
2356 __field(u32, fhandle)
2357 __field(u64, fileid)
2358 __field(loff_t, offset)
2359 __field(u32, count)
2360 __string(dstaddr, data->ds_clp ?
2361 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2362 RPC_DISPLAY_ADDR) : "unknown")
2363 ),
2364
2365 TP_fast_assign(
2366 const struct inode *inode = data->inode;
2367
2368 __entry->error = data->res.op_status;
2369 __entry->fhandle = nfs_fhandle_hash(data->args.fh);
2370 __entry->fileid = NFS_FILEID(inode);
2371 __entry->dev = inode->i_sb->s_dev;
2372 __entry->offset = data->args.offset;
2373 __entry->count = data->args.count;
2374 __assign_str(dstaddr, data->ds_clp ?
2375 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2376 RPC_DISPLAY_ADDR) : "unknown");
2377 ),
2378
2379 TP_printk(
2380 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2381 "offset=%llu count=%u dstaddr=%s",
2382 -__entry->error,
2383 show_nfsv4_errors(__entry->error),
2384 MAJOR(__entry->dev), MINOR(__entry->dev),
2385 (unsigned long long)__entry->fileid,
2386 __entry->fhandle,
2387 __entry->offset, __entry->count,
2388 __get_str(dstaddr)
2389 )
2390);
2391
2392
Trond Myklebustcc668ab2013-08-14 15:31:28 -04002393#endif /* CONFIG_NFS_V4_1 */
2394
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002395#endif /* _TRACE_NFS4_H */
2396
2397#undef TRACE_INCLUDE_PATH
2398#define TRACE_INCLUDE_PATH .
2399#define TRACE_INCLUDE_FILE nfs4trace
2400/* This part must be outside protection */
2401#include <trace/define_trace.h>