xref: /linux/fs/nfsd/trace.h (revision 8b8eed05a1c650c27e78bc47d07f7d6c9ba779e8)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2014 Christoph Hellwig.
4  */
5 #undef TRACE_SYSTEM
6 #define TRACE_SYSTEM nfsd
7 
8 #if !defined(_NFSD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _NFSD_TRACE_H
10 
11 #include <linux/tracepoint.h>
12 #include <linux/sunrpc/xprt.h>
13 #include <trace/misc/nfs.h>
14 
15 #include "export.h"
16 #include "nfsfh.h"
17 #include "xdr4.h"
18 
19 #define NFSD_TRACE_PROC_RES_FIELDS \
20 		__field(unsigned int, netns_ino) \
21 		__field(u32, xid) \
22 		__field(unsigned long, status) \
23 		__array(unsigned char, server, sizeof(struct sockaddr_in6)) \
24 		__array(unsigned char, client, sizeof(struct sockaddr_in6))
25 
26 #define NFSD_TRACE_PROC_RES_ASSIGNMENTS(error) \
27 		do { \
28 			__entry->netns_ino = SVC_NET(rqstp)->ns.inum; \
29 			__entry->xid = be32_to_cpu(rqstp->rq_xid); \
30 			__entry->status = be32_to_cpu(error); \
31 			memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \
32 			       rqstp->rq_xprt->xpt_locallen); \
33 			memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \
34 			       rqstp->rq_xprt->xpt_remotelen); \
35 		} while (0);
36 
37 DECLARE_EVENT_CLASS(nfsd_xdr_err_class,
38 	TP_PROTO(
39 		const struct svc_rqst *rqstp
40 	),
41 	TP_ARGS(rqstp),
42 	TP_STRUCT__entry(
43 		__field(unsigned int, netns_ino)
44 		__field(u32, xid)
45 		__field(u32, vers)
46 		__field(u32, proc)
47 		__sockaddr(server, rqstp->rq_xprt->xpt_locallen)
48 		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
49 	),
50 	TP_fast_assign(
51 		const struct svc_xprt *xprt = rqstp->rq_xprt;
52 
53 		__entry->netns_ino = xprt->xpt_net->ns.inum;
54 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
55 		__entry->vers = rqstp->rq_vers;
56 		__entry->proc = rqstp->rq_proc;
57 		__assign_sockaddr(server, &xprt->xpt_local, xprt->xpt_locallen);
58 		__assign_sockaddr(client, &xprt->xpt_remote, xprt->xpt_remotelen);
59 	),
60 	TP_printk("xid=0x%08x vers=%u proc=%u",
61 		__entry->xid, __entry->vers, __entry->proc
62 	)
63 );
64 
65 #define DEFINE_NFSD_XDR_ERR_EVENT(name) \
66 DEFINE_EVENT(nfsd_xdr_err_class, nfsd_##name##_err, \
67 	TP_PROTO(const struct svc_rqst *rqstp), \
68 	TP_ARGS(rqstp))
69 
70 DEFINE_NFSD_XDR_ERR_EVENT(garbage_args);
71 DEFINE_NFSD_XDR_ERR_EVENT(cant_encode);
72 
73 #define show_nfsd_may_flags(x)						\
74 	__print_flags(x, "|",						\
75 		{ NFSD_MAY_EXEC,		"EXEC" },		\
76 		{ NFSD_MAY_WRITE,		"WRITE" },		\
77 		{ NFSD_MAY_READ,		"READ" },		\
78 		{ NFSD_MAY_SATTR,		"SATTR" },		\
79 		{ NFSD_MAY_TRUNC,		"TRUNC" },		\
80 		{ NFSD_MAY_LOCK,		"LOCK" },		\
81 		{ NFSD_MAY_OWNER_OVERRIDE,	"OWNER_OVERRIDE" },	\
82 		{ NFSD_MAY_LOCAL_ACCESS,	"LOCAL_ACCESS" },	\
83 		{ NFSD_MAY_BYPASS_GSS_ON_ROOT,	"BYPASS_GSS_ON_ROOT" },	\
84 		{ NFSD_MAY_NOT_BREAK_LEASE,	"NOT_BREAK_LEASE" },	\
85 		{ NFSD_MAY_BYPASS_GSS,		"BYPASS_GSS" },		\
86 		{ NFSD_MAY_READ_IF_EXEC,	"READ_IF_EXEC" },	\
87 		{ NFSD_MAY_64BIT_COOKIE,	"64BIT_COOKIE" })
88 
89 TRACE_EVENT(nfsd_compound,
90 	TP_PROTO(
91 		const struct svc_rqst *rqst,
92 		const char *tag,
93 		u32 taglen,
94 		u32 opcnt
95 	),
96 	TP_ARGS(rqst, tag, taglen, opcnt),
97 	TP_STRUCT__entry(
98 		__field(u32, xid)
99 		__field(u32, opcnt)
100 		__string_len(tag, tag, taglen)
101 	),
102 	TP_fast_assign(
103 		__entry->xid = be32_to_cpu(rqst->rq_xid);
104 		__entry->opcnt = opcnt;
105 		__assign_str_len(tag, tag, taglen);
106 	),
107 	TP_printk("xid=0x%08x opcnt=%u tag=%s",
108 		__entry->xid, __entry->opcnt, __get_str(tag)
109 	)
110 )
111 
112 TRACE_EVENT(nfsd_compound_status,
113 	TP_PROTO(u32 args_opcnt,
114 		 u32 resp_opcnt,
115 		 __be32 status,
116 		 const char *name),
117 	TP_ARGS(args_opcnt, resp_opcnt, status, name),
118 	TP_STRUCT__entry(
119 		__field(u32, args_opcnt)
120 		__field(u32, resp_opcnt)
121 		__field(int, status)
122 		__string(name, name)
123 	),
124 	TP_fast_assign(
125 		__entry->args_opcnt = args_opcnt;
126 		__entry->resp_opcnt = resp_opcnt;
127 		__entry->status = be32_to_cpu(status);
128 		__assign_str(name, name);
129 	),
130 	TP_printk("op=%u/%u %s status=%d",
131 		__entry->resp_opcnt, __entry->args_opcnt,
132 		__get_str(name), __entry->status)
133 )
134 
135 TRACE_EVENT(nfsd_compound_decode_err,
136 	TP_PROTO(
137 		const struct svc_rqst *rqstp,
138 		u32 args_opcnt,
139 		u32 resp_opcnt,
140 		u32 opnum,
141 		__be32 status
142 	),
143 	TP_ARGS(rqstp, args_opcnt, resp_opcnt, opnum, status),
144 	TP_STRUCT__entry(
145 		NFSD_TRACE_PROC_RES_FIELDS
146 
147 		__field(u32, args_opcnt)
148 		__field(u32, resp_opcnt)
149 		__field(u32, opnum)
150 	),
151 	TP_fast_assign(
152 		NFSD_TRACE_PROC_RES_ASSIGNMENTS(status)
153 
154 		__entry->args_opcnt = args_opcnt;
155 		__entry->resp_opcnt = resp_opcnt;
156 		__entry->opnum = opnum;
157 	),
158 	TP_printk("op=%u/%u opnum=%u status=%lu",
159 		__entry->resp_opcnt, __entry->args_opcnt,
160 		__entry->opnum, __entry->status)
161 );
162 
163 TRACE_EVENT(nfsd_compound_encode_err,
164 	TP_PROTO(
165 		const struct svc_rqst *rqstp,
166 		u32 opnum,
167 		__be32 status
168 	),
169 	TP_ARGS(rqstp, opnum, status),
170 	TP_STRUCT__entry(
171 		NFSD_TRACE_PROC_RES_FIELDS
172 
173 		__field(u32, opnum)
174 	),
175 	TP_fast_assign(
176 		NFSD_TRACE_PROC_RES_ASSIGNMENTS(status)
177 
178 		__entry->opnum = opnum;
179 	),
180 	TP_printk("opnum=%u status=%lu",
181 		__entry->opnum, __entry->status)
182 );
183 
184 #define show_fs_file_type(x) \
185 	__print_symbolic(x, \
186 		{ S_IFLNK,		"LNK" }, \
187 		{ S_IFREG,		"REG" }, \
188 		{ S_IFDIR,		"DIR" }, \
189 		{ S_IFCHR,		"CHR" }, \
190 		{ S_IFBLK,		"BLK" }, \
191 		{ S_IFIFO,		"FIFO" }, \
192 		{ S_IFSOCK,		"SOCK" })
193 
194 TRACE_EVENT(nfsd_fh_verify,
195 	TP_PROTO(
196 		const struct svc_rqst *rqstp,
197 		const struct svc_fh *fhp,
198 		umode_t type,
199 		int access
200 	),
201 	TP_ARGS(rqstp, fhp, type, access),
202 	TP_STRUCT__entry(
203 		__field(unsigned int, netns_ino)
204 		__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
205 		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
206 		__field(u32, xid)
207 		__field(u32, fh_hash)
208 		__field(const void *, inode)
209 		__field(unsigned long, type)
210 		__field(unsigned long, access)
211 	),
212 	TP_fast_assign(
213 		__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
214 		__assign_sockaddr(server, &rqstp->rq_xprt->xpt_local,
215 		       rqstp->rq_xprt->xpt_locallen);
216 		__assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote,
217 				  rqstp->rq_xprt->xpt_remotelen);
218 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
219 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
220 		__entry->inode = d_inode(fhp->fh_dentry);
221 		__entry->type = type;
222 		__entry->access = access;
223 	),
224 	TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s",
225 		__entry->xid, __entry->fh_hash,
226 		show_fs_file_type(__entry->type),
227 		show_nfsd_may_flags(__entry->access)
228 	)
229 );
230 
231 TRACE_EVENT_CONDITION(nfsd_fh_verify_err,
232 	TP_PROTO(
233 		const struct svc_rqst *rqstp,
234 		const struct svc_fh *fhp,
235 		umode_t type,
236 		int access,
237 		__be32 error
238 	),
239 	TP_ARGS(rqstp, fhp, type, access, error),
240 	TP_CONDITION(error),
241 	TP_STRUCT__entry(
242 		__field(unsigned int, netns_ino)
243 		__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
244 		__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
245 		__field(u32, xid)
246 		__field(u32, fh_hash)
247 		__field(const void *, inode)
248 		__field(unsigned long, type)
249 		__field(unsigned long, access)
250 		__field(int, error)
251 	),
252 	TP_fast_assign(
253 		__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
254 		__assign_sockaddr(server, &rqstp->rq_xprt->xpt_local,
255 		       rqstp->rq_xprt->xpt_locallen);
256 		__assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote,
257 				  rqstp->rq_xprt->xpt_remotelen);
258 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
259 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
260 		if (fhp->fh_dentry)
261 			__entry->inode = d_inode(fhp->fh_dentry);
262 		else
263 			__entry->inode = NULL;
264 		__entry->type = type;
265 		__entry->access = access;
266 		__entry->error = be32_to_cpu(error);
267 	),
268 	TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s error=%d",
269 		__entry->xid, __entry->fh_hash,
270 		show_fs_file_type(__entry->type),
271 		show_nfsd_may_flags(__entry->access),
272 		__entry->error
273 	)
274 );
275 
276 DECLARE_EVENT_CLASS(nfsd_fh_err_class,
277 	TP_PROTO(struct svc_rqst *rqstp,
278 		 struct svc_fh	*fhp,
279 		 int		status),
280 	TP_ARGS(rqstp, fhp, status),
281 	TP_STRUCT__entry(
282 		__field(u32, xid)
283 		__field(u32, fh_hash)
284 		__field(int, status)
285 	),
286 	TP_fast_assign(
287 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
288 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
289 		__entry->status = status;
290 	),
291 	TP_printk("xid=0x%08x fh_hash=0x%08x status=%d",
292 		  __entry->xid, __entry->fh_hash,
293 		  __entry->status)
294 )
295 
296 #define DEFINE_NFSD_FH_ERR_EVENT(name)		\
297 DEFINE_EVENT(nfsd_fh_err_class, nfsd_##name,	\
298 	TP_PROTO(struct svc_rqst *rqstp,	\
299 		 struct svc_fh	*fhp,		\
300 		 int		status),	\
301 	TP_ARGS(rqstp, fhp, status))
302 
303 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport);
304 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle);
305 
306 TRACE_EVENT(nfsd_exp_find_key,
307 	TP_PROTO(const struct svc_expkey *key,
308 		 int status),
309 	TP_ARGS(key, status),
310 	TP_STRUCT__entry(
311 		__field(int, fsidtype)
312 		__array(u32, fsid, 6)
313 		__string(auth_domain, key->ek_client->name)
314 		__field(int, status)
315 	),
316 	TP_fast_assign(
317 		__entry->fsidtype = key->ek_fsidtype;
318 		memcpy(__entry->fsid, key->ek_fsid, 4*6);
319 		__assign_str(auth_domain, key->ek_client->name);
320 		__entry->status = status;
321 	),
322 	TP_printk("fsid=%x::%s domain=%s status=%d",
323 		__entry->fsidtype,
324 		__print_array(__entry->fsid, 6, 4),
325 		__get_str(auth_domain),
326 		__entry->status
327 	)
328 );
329 
330 TRACE_EVENT(nfsd_expkey_update,
331 	TP_PROTO(const struct svc_expkey *key, const char *exp_path),
332 	TP_ARGS(key, exp_path),
333 	TP_STRUCT__entry(
334 		__field(int, fsidtype)
335 		__array(u32, fsid, 6)
336 		__string(auth_domain, key->ek_client->name)
337 		__string(path, exp_path)
338 		__field(bool, cache)
339 	),
340 	TP_fast_assign(
341 		__entry->fsidtype = key->ek_fsidtype;
342 		memcpy(__entry->fsid, key->ek_fsid, 4*6);
343 		__assign_str(auth_domain, key->ek_client->name);
344 		__assign_str(path, exp_path);
345 		__entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
346 	),
347 	TP_printk("fsid=%x::%s domain=%s path=%s cache=%s",
348 		__entry->fsidtype,
349 		__print_array(__entry->fsid, 6, 4),
350 		__get_str(auth_domain),
351 		__get_str(path),
352 		__entry->cache ? "pos" : "neg"
353 	)
354 );
355 
356 TRACE_EVENT(nfsd_exp_get_by_name,
357 	TP_PROTO(const struct svc_export *key,
358 		 int status),
359 	TP_ARGS(key, status),
360 	TP_STRUCT__entry(
361 		__string(path, key->ex_path.dentry->d_name.name)
362 		__string(auth_domain, key->ex_client->name)
363 		__field(int, status)
364 	),
365 	TP_fast_assign(
366 		__assign_str(path, key->ex_path.dentry->d_name.name);
367 		__assign_str(auth_domain, key->ex_client->name);
368 		__entry->status = status;
369 	),
370 	TP_printk("path=%s domain=%s status=%d",
371 		__get_str(path),
372 		__get_str(auth_domain),
373 		__entry->status
374 	)
375 );
376 
377 TRACE_EVENT(nfsd_export_update,
378 	TP_PROTO(const struct svc_export *key),
379 	TP_ARGS(key),
380 	TP_STRUCT__entry(
381 		__string(path, key->ex_path.dentry->d_name.name)
382 		__string(auth_domain, key->ex_client->name)
383 		__field(bool, cache)
384 	),
385 	TP_fast_assign(
386 		__assign_str(path, key->ex_path.dentry->d_name.name);
387 		__assign_str(auth_domain, key->ex_client->name);
388 		__entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
389 	),
390 	TP_printk("path=%s domain=%s cache=%s",
391 		__get_str(path),
392 		__get_str(auth_domain),
393 		__entry->cache ? "pos" : "neg"
394 	)
395 );
396 
397 DECLARE_EVENT_CLASS(nfsd_io_class,
398 	TP_PROTO(struct svc_rqst *rqstp,
399 		 struct svc_fh	*fhp,
400 		 u64		offset,
401 		 u32		len),
402 	TP_ARGS(rqstp, fhp, offset, len),
403 	TP_STRUCT__entry(
404 		__field(u32, xid)
405 		__field(u32, fh_hash)
406 		__field(u64, offset)
407 		__field(u32, len)
408 	),
409 	TP_fast_assign(
410 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
411 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
412 		__entry->offset = offset;
413 		__entry->len = len;
414 	),
415 	TP_printk("xid=0x%08x fh_hash=0x%08x offset=%llu len=%u",
416 		  __entry->xid, __entry->fh_hash,
417 		  __entry->offset, __entry->len)
418 )
419 
420 #define DEFINE_NFSD_IO_EVENT(name)		\
421 DEFINE_EVENT(nfsd_io_class, nfsd_##name,	\
422 	TP_PROTO(struct svc_rqst *rqstp,	\
423 		 struct svc_fh	*fhp,		\
424 		 u64		offset,		\
425 		 u32		len),		\
426 	TP_ARGS(rqstp, fhp, offset, len))
427 
428 DEFINE_NFSD_IO_EVENT(read_start);
429 DEFINE_NFSD_IO_EVENT(read_splice);
430 DEFINE_NFSD_IO_EVENT(read_vector);
431 DEFINE_NFSD_IO_EVENT(read_io_done);
432 DEFINE_NFSD_IO_EVENT(read_done);
433 DEFINE_NFSD_IO_EVENT(write_start);
434 DEFINE_NFSD_IO_EVENT(write_opened);
435 DEFINE_NFSD_IO_EVENT(write_io_done);
436 DEFINE_NFSD_IO_EVENT(write_done);
437 
438 DECLARE_EVENT_CLASS(nfsd_err_class,
439 	TP_PROTO(struct svc_rqst *rqstp,
440 		 struct svc_fh	*fhp,
441 		 loff_t		offset,
442 		 int		status),
443 	TP_ARGS(rqstp, fhp, offset, status),
444 	TP_STRUCT__entry(
445 		__field(u32, xid)
446 		__field(u32, fh_hash)
447 		__field(loff_t, offset)
448 		__field(int, status)
449 	),
450 	TP_fast_assign(
451 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
452 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
453 		__entry->offset = offset;
454 		__entry->status = status;
455 	),
456 	TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d",
457 		  __entry->xid, __entry->fh_hash,
458 		  __entry->offset, __entry->status)
459 )
460 
461 #define DEFINE_NFSD_ERR_EVENT(name)		\
462 DEFINE_EVENT(nfsd_err_class, nfsd_##name,	\
463 	TP_PROTO(struct svc_rqst *rqstp,	\
464 		 struct svc_fh	*fhp,		\
465 		 loff_t		offset,		\
466 		 int		len),		\
467 	TP_ARGS(rqstp, fhp, offset, len))
468 
469 DEFINE_NFSD_ERR_EVENT(read_err);
470 DEFINE_NFSD_ERR_EVENT(write_err);
471 
472 TRACE_EVENT(nfsd_dirent,
473 	TP_PROTO(struct svc_fh *fhp,
474 		 u64 ino,
475 		 const char *name,
476 		 int namlen),
477 	TP_ARGS(fhp, ino, name, namlen),
478 	TP_STRUCT__entry(
479 		__field(u32, fh_hash)
480 		__field(u64, ino)
481 		__string_len(name, name, namlen)
482 	),
483 	TP_fast_assign(
484 		__entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0;
485 		__entry->ino = ino;
486 		__assign_str_len(name, name, namlen)
487 	),
488 	TP_printk("fh_hash=0x%08x ino=%llu name=%s",
489 		__entry->fh_hash, __entry->ino, __get_str(name)
490 	)
491 )
492 
493 DECLARE_EVENT_CLASS(nfsd_copy_err_class,
494 	TP_PROTO(struct svc_rqst *rqstp,
495 		 struct svc_fh	*src_fhp,
496 		 loff_t		src_offset,
497 		 struct svc_fh	*dst_fhp,
498 		 loff_t		dst_offset,
499 		 u64		count,
500 		 int		status),
501 	TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, count, status),
502 	TP_STRUCT__entry(
503 		__field(u32, xid)
504 		__field(u32, src_fh_hash)
505 		__field(loff_t, src_offset)
506 		__field(u32, dst_fh_hash)
507 		__field(loff_t, dst_offset)
508 		__field(u64, count)
509 		__field(int, status)
510 	),
511 	TP_fast_assign(
512 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
513 		__entry->src_fh_hash = knfsd_fh_hash(&src_fhp->fh_handle);
514 		__entry->src_offset = src_offset;
515 		__entry->dst_fh_hash = knfsd_fh_hash(&dst_fhp->fh_handle);
516 		__entry->dst_offset = dst_offset;
517 		__entry->count = count;
518 		__entry->status = status;
519 	),
520 	TP_printk("xid=0x%08x src_fh_hash=0x%08x src_offset=%lld "
521 			"dst_fh_hash=0x%08x dst_offset=%lld "
522 			"count=%llu status=%d",
523 		  __entry->xid, __entry->src_fh_hash, __entry->src_offset,
524 		  __entry->dst_fh_hash, __entry->dst_offset,
525 		  (unsigned long long)__entry->count,
526 		  __entry->status)
527 )
528 
529 #define DEFINE_NFSD_COPY_ERR_EVENT(name)		\
530 DEFINE_EVENT(nfsd_copy_err_class, nfsd_##name,		\
531 	TP_PROTO(struct svc_rqst	*rqstp,		\
532 		 struct svc_fh		*src_fhp,	\
533 		 loff_t			src_offset,	\
534 		 struct svc_fh		*dst_fhp,	\
535 		 loff_t			dst_offset,	\
536 		 u64			count,		\
537 		 int			status),	\
538 	TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, \
539 		count, status))
540 
541 DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err);
542 
543 #include "state.h"
544 #include "filecache.h"
545 #include "vfs.h"
546 
547 TRACE_EVENT(nfsd_delegret_wakeup,
548 	TP_PROTO(
549 		const struct svc_rqst *rqstp,
550 		const struct inode *inode,
551 		long timeo
552 	),
553 	TP_ARGS(rqstp, inode, timeo),
554 	TP_STRUCT__entry(
555 		__field(u32, xid)
556 		__field(const void *, inode)
557 		__field(long, timeo)
558 	),
559 	TP_fast_assign(
560 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
561 		__entry->inode = inode;
562 		__entry->timeo = timeo;
563 	),
564 	TP_printk("xid=0x%08x inode=%p%s",
565 		  __entry->xid, __entry->inode,
566 		  __entry->timeo == 0 ? " (timed out)" : ""
567 	)
568 );
569 
570 DECLARE_EVENT_CLASS(nfsd_stateid_class,
571 	TP_PROTO(stateid_t *stp),
572 	TP_ARGS(stp),
573 	TP_STRUCT__entry(
574 		__field(u32, cl_boot)
575 		__field(u32, cl_id)
576 		__field(u32, si_id)
577 		__field(u32, si_generation)
578 	),
579 	TP_fast_assign(
580 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
581 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
582 		__entry->si_id = stp->si_opaque.so_id;
583 		__entry->si_generation = stp->si_generation;
584 	),
585 	TP_printk("client %08x:%08x stateid %08x:%08x",
586 		__entry->cl_boot,
587 		__entry->cl_id,
588 		__entry->si_id,
589 		__entry->si_generation)
590 )
591 
592 #define DEFINE_STATEID_EVENT(name) \
593 DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \
594 	TP_PROTO(stateid_t *stp), \
595 	TP_ARGS(stp))
596 
597 DEFINE_STATEID_EVENT(layoutstate_alloc);
598 DEFINE_STATEID_EVENT(layoutstate_unhash);
599 DEFINE_STATEID_EVENT(layoutstate_free);
600 DEFINE_STATEID_EVENT(layout_get_lookup_fail);
601 DEFINE_STATEID_EVENT(layout_commit_lookup_fail);
602 DEFINE_STATEID_EVENT(layout_return_lookup_fail);
603 DEFINE_STATEID_EVENT(layout_recall);
604 DEFINE_STATEID_EVENT(layout_recall_done);
605 DEFINE_STATEID_EVENT(layout_recall_fail);
606 DEFINE_STATEID_EVENT(layout_recall_release);
607 
608 DEFINE_STATEID_EVENT(open);
609 DEFINE_STATEID_EVENT(deleg_read);
610 DEFINE_STATEID_EVENT(deleg_write);
611 DEFINE_STATEID_EVENT(deleg_return);
612 DEFINE_STATEID_EVENT(deleg_recall);
613 
614 DECLARE_EVENT_CLASS(nfsd_stateseqid_class,
615 	TP_PROTO(u32 seqid, const stateid_t *stp),
616 	TP_ARGS(seqid, stp),
617 	TP_STRUCT__entry(
618 		__field(u32, seqid)
619 		__field(u32, cl_boot)
620 		__field(u32, cl_id)
621 		__field(u32, si_id)
622 		__field(u32, si_generation)
623 	),
624 	TP_fast_assign(
625 		__entry->seqid = seqid;
626 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
627 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
628 		__entry->si_id = stp->si_opaque.so_id;
629 		__entry->si_generation = stp->si_generation;
630 	),
631 	TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x",
632 		__entry->seqid, __entry->cl_boot, __entry->cl_id,
633 		__entry->si_id, __entry->si_generation)
634 )
635 
636 #define DEFINE_STATESEQID_EVENT(name) \
637 DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \
638 	TP_PROTO(u32 seqid, const stateid_t *stp), \
639 	TP_ARGS(seqid, stp))
640 
641 DEFINE_STATESEQID_EVENT(preprocess);
642 DEFINE_STATESEQID_EVENT(open_confirm);
643 
644 TRACE_DEFINE_ENUM(NFS4_OPEN_STID);
645 TRACE_DEFINE_ENUM(NFS4_LOCK_STID);
646 TRACE_DEFINE_ENUM(NFS4_DELEG_STID);
647 TRACE_DEFINE_ENUM(NFS4_CLOSED_STID);
648 TRACE_DEFINE_ENUM(NFS4_REVOKED_DELEG_STID);
649 TRACE_DEFINE_ENUM(NFS4_CLOSED_DELEG_STID);
650 TRACE_DEFINE_ENUM(NFS4_LAYOUT_STID);
651 
652 #define show_stid_type(x)						\
653 	__print_flags(x, "|",						\
654 		{ NFS4_OPEN_STID,		"OPEN" },		\
655 		{ NFS4_LOCK_STID,		"LOCK" },		\
656 		{ NFS4_DELEG_STID,		"DELEG" },		\
657 		{ NFS4_CLOSED_STID,		"CLOSED" },		\
658 		{ NFS4_REVOKED_DELEG_STID,	"REVOKED" },		\
659 		{ NFS4_CLOSED_DELEG_STID,	"CLOSED_DELEG" },	\
660 		{ NFS4_LAYOUT_STID,		"LAYOUT" })
661 
662 DECLARE_EVENT_CLASS(nfsd_stid_class,
663 	TP_PROTO(
664 		const struct nfs4_stid *stid
665 	),
666 	TP_ARGS(stid),
667 	TP_STRUCT__entry(
668 		__field(unsigned long, sc_type)
669 		__field(int, sc_count)
670 		__field(u32, cl_boot)
671 		__field(u32, cl_id)
672 		__field(u32, si_id)
673 		__field(u32, si_generation)
674 	),
675 	TP_fast_assign(
676 		const stateid_t *stp = &stid->sc_stateid;
677 
678 		__entry->sc_type = stid->sc_type;
679 		__entry->sc_count = refcount_read(&stid->sc_count);
680 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
681 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
682 		__entry->si_id = stp->si_opaque.so_id;
683 		__entry->si_generation = stp->si_generation;
684 	),
685 	TP_printk("client %08x:%08x stateid %08x:%08x ref=%d type=%s",
686 		__entry->cl_boot, __entry->cl_id,
687 		__entry->si_id, __entry->si_generation,
688 		__entry->sc_count, show_stid_type(__entry->sc_type)
689 	)
690 );
691 
692 #define DEFINE_STID_EVENT(name)					\
693 DEFINE_EVENT(nfsd_stid_class, nfsd_stid_##name,			\
694 	TP_PROTO(const struct nfs4_stid *stid),			\
695 	TP_ARGS(stid))
696 
697 DEFINE_STID_EVENT(revoke);
698 
699 DECLARE_EVENT_CLASS(nfsd_clientid_class,
700 	TP_PROTO(const clientid_t *clid),
701 	TP_ARGS(clid),
702 	TP_STRUCT__entry(
703 		__field(u32, cl_boot)
704 		__field(u32, cl_id)
705 	),
706 	TP_fast_assign(
707 		__entry->cl_boot = clid->cl_boot;
708 		__entry->cl_id = clid->cl_id;
709 	),
710 	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
711 )
712 
713 #define DEFINE_CLIENTID_EVENT(name) \
714 DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \
715 	TP_PROTO(const clientid_t *clid), \
716 	TP_ARGS(clid))
717 
718 DEFINE_CLIENTID_EVENT(expire_unconf);
719 DEFINE_CLIENTID_EVENT(reclaim_complete);
720 DEFINE_CLIENTID_EVENT(confirmed);
721 DEFINE_CLIENTID_EVENT(destroyed);
722 DEFINE_CLIENTID_EVENT(admin_expired);
723 DEFINE_CLIENTID_EVENT(replaced);
724 DEFINE_CLIENTID_EVENT(purged);
725 DEFINE_CLIENTID_EVENT(renew);
726 DEFINE_CLIENTID_EVENT(stale);
727 
728 DECLARE_EVENT_CLASS(nfsd_net_class,
729 	TP_PROTO(const struct nfsd_net *nn),
730 	TP_ARGS(nn),
731 	TP_STRUCT__entry(
732 		__field(unsigned long long, boot_time)
733 	),
734 	TP_fast_assign(
735 		__entry->boot_time = nn->boot_time;
736 	),
737 	TP_printk("boot_time=%16llx", __entry->boot_time)
738 )
739 
740 #define DEFINE_NET_EVENT(name) \
741 DEFINE_EVENT(nfsd_net_class, nfsd_##name, \
742 	TP_PROTO(const struct nfsd_net *nn), \
743 	TP_ARGS(nn))
744 
745 DEFINE_NET_EVENT(grace_start);
746 DEFINE_NET_EVENT(grace_complete);
747 
748 TRACE_EVENT(nfsd_writeverf_reset,
749 	TP_PROTO(
750 		const struct nfsd_net *nn,
751 		const struct svc_rqst *rqstp,
752 		int error
753 	),
754 	TP_ARGS(nn, rqstp, error),
755 	TP_STRUCT__entry(
756 		__field(unsigned long long, boot_time)
757 		__field(u32, xid)
758 		__field(int, error)
759 		__array(unsigned char, verifier, NFS4_VERIFIER_SIZE)
760 	),
761 	TP_fast_assign(
762 		__entry->boot_time = nn->boot_time;
763 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
764 		__entry->error = error;
765 
766 		/* avoid seqlock inside TP_fast_assign */
767 		memcpy(__entry->verifier, nn->writeverf,
768 		       NFS4_VERIFIER_SIZE);
769 	),
770 	TP_printk("boot_time=%16llx xid=0x%08x error=%d new verifier=0x%s",
771 		__entry->boot_time, __entry->xid, __entry->error,
772 		__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
773 	)
774 );
775 
776 TRACE_EVENT(nfsd_clid_cred_mismatch,
777 	TP_PROTO(
778 		const struct nfs4_client *clp,
779 		const struct svc_rqst *rqstp
780 	),
781 	TP_ARGS(clp, rqstp),
782 	TP_STRUCT__entry(
783 		__field(u32, cl_boot)
784 		__field(u32, cl_id)
785 		__field(unsigned long, cl_flavor)
786 		__field(unsigned long, new_flavor)
787 		__sockaddr(addr, rqstp->rq_xprt->xpt_remotelen)
788 	),
789 	TP_fast_assign(
790 		__entry->cl_boot = clp->cl_clientid.cl_boot;
791 		__entry->cl_id = clp->cl_clientid.cl_id;
792 		__entry->cl_flavor = clp->cl_cred.cr_flavor;
793 		__entry->new_flavor = rqstp->rq_cred.cr_flavor;
794 		__assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote,
795 				  rqstp->rq_xprt->xpt_remotelen);
796 	),
797 	TP_printk("client %08x:%08x flavor=%s, conflict=%s from addr=%pISpc",
798 		__entry->cl_boot, __entry->cl_id,
799 		show_nfsd_authflavor(__entry->cl_flavor),
800 		show_nfsd_authflavor(__entry->new_flavor),
801 		__get_sockaddr(addr)
802 	)
803 )
804 
805 TRACE_EVENT(nfsd_clid_verf_mismatch,
806 	TP_PROTO(
807 		const struct nfs4_client *clp,
808 		const struct svc_rqst *rqstp,
809 		const nfs4_verifier *verf
810 	),
811 	TP_ARGS(clp, rqstp, verf),
812 	TP_STRUCT__entry(
813 		__field(u32, cl_boot)
814 		__field(u32, cl_id)
815 		__array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE)
816 		__array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE)
817 		__sockaddr(addr, rqstp->rq_xprt->xpt_remotelen)
818 	),
819 	TP_fast_assign(
820 		__entry->cl_boot = clp->cl_clientid.cl_boot;
821 		__entry->cl_id = clp->cl_clientid.cl_id;
822 		memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier,
823 		       NFS4_VERIFIER_SIZE);
824 		memcpy(__entry->new_verifier, (void *)verf,
825 		       NFS4_VERIFIER_SIZE);
826 		__assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote,
827 				  rqstp->rq_xprt->xpt_remotelen);
828 	),
829 	TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc",
830 		__entry->cl_boot, __entry->cl_id,
831 		__print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE),
832 		__print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE),
833 		__get_sockaddr(addr)
834 	)
835 );
836 
837 DECLARE_EVENT_CLASS(nfsd_clid_class,
838 	TP_PROTO(const struct nfs4_client *clp),
839 	TP_ARGS(clp),
840 	TP_STRUCT__entry(
841 		__field(u32, cl_boot)
842 		__field(u32, cl_id)
843 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
844 		__field(unsigned long, flavor)
845 		__array(unsigned char, verifier, NFS4_VERIFIER_SIZE)
846 		__string_len(name, name, clp->cl_name.len)
847 	),
848 	TP_fast_assign(
849 		__entry->cl_boot = clp->cl_clientid.cl_boot;
850 		__entry->cl_id = clp->cl_clientid.cl_id;
851 		memcpy(__entry->addr, &clp->cl_addr,
852 			sizeof(struct sockaddr_in6));
853 		__entry->flavor = clp->cl_cred.cr_flavor;
854 		memcpy(__entry->verifier, (void *)&clp->cl_verifier,
855 		       NFS4_VERIFIER_SIZE);
856 		__assign_str_len(name, clp->cl_name.data, clp->cl_name.len);
857 	),
858 	TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x",
859 		__entry->addr, __get_str(name),
860 		__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE),
861 		show_nfsd_authflavor(__entry->flavor),
862 		__entry->cl_boot, __entry->cl_id)
863 );
864 
865 #define DEFINE_CLID_EVENT(name) \
866 DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \
867 	TP_PROTO(const struct nfs4_client *clp), \
868 	TP_ARGS(clp))
869 
870 DEFINE_CLID_EVENT(fresh);
871 DEFINE_CLID_EVENT(confirmed_r);
872 
873 /*
874  * from fs/nfsd/filecache.h
875  */
876 #define show_nf_flags(val)						\
877 	__print_flags(val, "|",						\
878 		{ 1 << NFSD_FILE_HASHED,	"HASHED" },		\
879 		{ 1 << NFSD_FILE_PENDING,	"PENDING" },		\
880 		{ 1 << NFSD_FILE_REFERENCED,	"REFERENCED" },		\
881 		{ 1 << NFSD_FILE_GC,		"GC" })
882 
883 DECLARE_EVENT_CLASS(nfsd_file_class,
884 	TP_PROTO(struct nfsd_file *nf),
885 	TP_ARGS(nf),
886 	TP_STRUCT__entry(
887 		__field(void *, nf_inode)
888 		__field(int, nf_ref)
889 		__field(unsigned long, nf_flags)
890 		__field(unsigned char, nf_may)
891 		__field(struct file *, nf_file)
892 	),
893 	TP_fast_assign(
894 		__entry->nf_inode = nf->nf_inode;
895 		__entry->nf_ref = refcount_read(&nf->nf_ref);
896 		__entry->nf_flags = nf->nf_flags;
897 		__entry->nf_may = nf->nf_may;
898 		__entry->nf_file = nf->nf_file;
899 	),
900 	TP_printk("inode=%p ref=%d flags=%s may=%s nf_file=%p",
901 		__entry->nf_inode,
902 		__entry->nf_ref,
903 		show_nf_flags(__entry->nf_flags),
904 		show_nfsd_may_flags(__entry->nf_may),
905 		__entry->nf_file)
906 )
907 
908 #define DEFINE_NFSD_FILE_EVENT(name) \
909 DEFINE_EVENT(nfsd_file_class, name, \
910 	TP_PROTO(struct nfsd_file *nf), \
911 	TP_ARGS(nf))
912 
913 DEFINE_NFSD_FILE_EVENT(nfsd_file_free);
914 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash);
915 DEFINE_NFSD_FILE_EVENT(nfsd_file_put);
916 DEFINE_NFSD_FILE_EVENT(nfsd_file_closing);
917 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_queue);
918 
919 TRACE_EVENT(nfsd_file_alloc,
920 	TP_PROTO(
921 		const struct nfsd_file *nf
922 	),
923 	TP_ARGS(nf),
924 	TP_STRUCT__entry(
925 		__field(const void *, nf_inode)
926 		__field(unsigned long, nf_flags)
927 		__field(unsigned long, nf_may)
928 		__field(unsigned int, nf_ref)
929 	),
930 	TP_fast_assign(
931 		__entry->nf_inode = nf->nf_inode;
932 		__entry->nf_flags = nf->nf_flags;
933 		__entry->nf_ref = refcount_read(&nf->nf_ref);
934 		__entry->nf_may = nf->nf_may;
935 	),
936 	TP_printk("inode=%p ref=%u flags=%s may=%s",
937 		__entry->nf_inode, __entry->nf_ref,
938 		show_nf_flags(__entry->nf_flags),
939 		show_nfsd_may_flags(__entry->nf_may)
940 	)
941 );
942 
943 TRACE_EVENT(nfsd_file_acquire,
944 	TP_PROTO(
945 		const struct svc_rqst *rqstp,
946 		const struct inode *inode,
947 		unsigned int may_flags,
948 		const struct nfsd_file *nf,
949 		__be32 status
950 	),
951 
952 	TP_ARGS(rqstp, inode, may_flags, nf, status),
953 
954 	TP_STRUCT__entry(
955 		__field(u32, xid)
956 		__field(const void *, inode)
957 		__field(unsigned long, may_flags)
958 		__field(unsigned int, nf_ref)
959 		__field(unsigned long, nf_flags)
960 		__field(unsigned long, nf_may)
961 		__field(const void *, nf_file)
962 		__field(u32, status)
963 	),
964 
965 	TP_fast_assign(
966 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
967 		__entry->inode = inode;
968 		__entry->may_flags = may_flags;
969 		__entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0;
970 		__entry->nf_flags = nf ? nf->nf_flags : 0;
971 		__entry->nf_may = nf ? nf->nf_may : 0;
972 		__entry->nf_file = nf ? nf->nf_file : NULL;
973 		__entry->status = be32_to_cpu(status);
974 	),
975 
976 	TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p status=%u",
977 			__entry->xid, __entry->inode,
978 			show_nfsd_may_flags(__entry->may_flags),
979 			__entry->nf_ref, show_nf_flags(__entry->nf_flags),
980 			show_nfsd_may_flags(__entry->nf_may),
981 			__entry->nf_file, __entry->status
982 	)
983 );
984 
985 TRACE_EVENT(nfsd_file_insert_err,
986 	TP_PROTO(
987 		const struct svc_rqst *rqstp,
988 		const struct inode *inode,
989 		unsigned int may_flags,
990 		long error
991 	),
992 	TP_ARGS(rqstp, inode, may_flags, error),
993 	TP_STRUCT__entry(
994 		__field(u32, xid)
995 		__field(const void *, inode)
996 		__field(unsigned long, may_flags)
997 		__field(long, error)
998 	),
999 	TP_fast_assign(
1000 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
1001 		__entry->inode = inode;
1002 		__entry->may_flags = may_flags;
1003 		__entry->error = error;
1004 	),
1005 	TP_printk("xid=0x%x inode=%p may_flags=%s error=%ld",
1006 		__entry->xid, __entry->inode,
1007 		show_nfsd_may_flags(__entry->may_flags),
1008 		__entry->error
1009 	)
1010 );
1011 
1012 TRACE_EVENT(nfsd_file_cons_err,
1013 	TP_PROTO(
1014 		const struct svc_rqst *rqstp,
1015 		const struct inode *inode,
1016 		unsigned int may_flags,
1017 		const struct nfsd_file *nf
1018 	),
1019 	TP_ARGS(rqstp, inode, may_flags, nf),
1020 	TP_STRUCT__entry(
1021 		__field(u32, xid)
1022 		__field(const void *, inode)
1023 		__field(unsigned long, may_flags)
1024 		__field(unsigned int, nf_ref)
1025 		__field(unsigned long, nf_flags)
1026 		__field(unsigned long, nf_may)
1027 		__field(const void *, nf_file)
1028 	),
1029 	TP_fast_assign(
1030 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
1031 		__entry->inode = inode;
1032 		__entry->may_flags = may_flags;
1033 		__entry->nf_ref = refcount_read(&nf->nf_ref);
1034 		__entry->nf_flags = nf->nf_flags;
1035 		__entry->nf_may = nf->nf_may;
1036 		__entry->nf_file = nf->nf_file;
1037 	),
1038 	TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p",
1039 		__entry->xid, __entry->inode,
1040 		show_nfsd_may_flags(__entry->may_flags), __entry->nf_ref,
1041 		show_nf_flags(__entry->nf_flags),
1042 		show_nfsd_may_flags(__entry->nf_may), __entry->nf_file
1043 	)
1044 );
1045 
1046 DECLARE_EVENT_CLASS(nfsd_file_open_class,
1047 	TP_PROTO(const struct nfsd_file *nf, __be32 status),
1048 	TP_ARGS(nf, status),
1049 	TP_STRUCT__entry(
1050 		__field(void *, nf_inode)	/* cannot be dereferenced */
1051 		__field(int, nf_ref)
1052 		__field(unsigned long, nf_flags)
1053 		__field(unsigned long, nf_may)
1054 		__field(void *, nf_file)	/* cannot be dereferenced */
1055 	),
1056 	TP_fast_assign(
1057 		__entry->nf_inode = nf->nf_inode;
1058 		__entry->nf_ref = refcount_read(&nf->nf_ref);
1059 		__entry->nf_flags = nf->nf_flags;
1060 		__entry->nf_may = nf->nf_may;
1061 		__entry->nf_file = nf->nf_file;
1062 	),
1063 	TP_printk("inode=%p ref=%d flags=%s may=%s file=%p",
1064 		__entry->nf_inode,
1065 		__entry->nf_ref,
1066 		show_nf_flags(__entry->nf_flags),
1067 		show_nfsd_may_flags(__entry->nf_may),
1068 		__entry->nf_file)
1069 )
1070 
1071 #define DEFINE_NFSD_FILE_OPEN_EVENT(name)					\
1072 DEFINE_EVENT(nfsd_file_open_class, name,					\
1073 	TP_PROTO(							\
1074 		const struct nfsd_file *nf,				\
1075 		__be32 status						\
1076 	),								\
1077 	TP_ARGS(nf, status))
1078 
1079 DEFINE_NFSD_FILE_OPEN_EVENT(nfsd_file_open);
1080 DEFINE_NFSD_FILE_OPEN_EVENT(nfsd_file_opened);
1081 
1082 TRACE_EVENT(nfsd_file_is_cached,
1083 	TP_PROTO(
1084 		const struct inode *inode,
1085 		int found
1086 	),
1087 	TP_ARGS(inode, found),
1088 	TP_STRUCT__entry(
1089 		__field(const struct inode *, inode)
1090 		__field(int, found)
1091 	),
1092 	TP_fast_assign(
1093 		__entry->inode = inode;
1094 		__entry->found = found;
1095 	),
1096 	TP_printk("inode=%p is %scached",
1097 		__entry->inode,
1098 		__entry->found ? "" : "not "
1099 	)
1100 );
1101 
1102 TRACE_EVENT(nfsd_file_fsnotify_handle_event,
1103 	TP_PROTO(struct inode *inode, u32 mask),
1104 	TP_ARGS(inode, mask),
1105 	TP_STRUCT__entry(
1106 		__field(struct inode *, inode)
1107 		__field(unsigned int, nlink)
1108 		__field(umode_t, mode)
1109 		__field(u32, mask)
1110 	),
1111 	TP_fast_assign(
1112 		__entry->inode = inode;
1113 		__entry->nlink = inode->i_nlink;
1114 		__entry->mode = inode->i_mode;
1115 		__entry->mask = mask;
1116 	),
1117 	TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode,
1118 			__entry->nlink, __entry->mode, __entry->mask)
1119 );
1120 
1121 DECLARE_EVENT_CLASS(nfsd_file_gc_class,
1122 	TP_PROTO(
1123 		const struct nfsd_file *nf
1124 	),
1125 	TP_ARGS(nf),
1126 	TP_STRUCT__entry(
1127 		__field(void *, nf_inode)
1128 		__field(void *, nf_file)
1129 		__field(int, nf_ref)
1130 		__field(unsigned long, nf_flags)
1131 	),
1132 	TP_fast_assign(
1133 		__entry->nf_inode = nf->nf_inode;
1134 		__entry->nf_file = nf->nf_file;
1135 		__entry->nf_ref = refcount_read(&nf->nf_ref);
1136 		__entry->nf_flags = nf->nf_flags;
1137 	),
1138 	TP_printk("inode=%p ref=%d nf_flags=%s nf_file=%p",
1139 		__entry->nf_inode, __entry->nf_ref,
1140 		show_nf_flags(__entry->nf_flags),
1141 		__entry->nf_file
1142 	)
1143 );
1144 
1145 #define DEFINE_NFSD_FILE_GC_EVENT(name)					\
1146 DEFINE_EVENT(nfsd_file_gc_class, name,					\
1147 	TP_PROTO(							\
1148 		const struct nfsd_file *nf				\
1149 	),								\
1150 	TP_ARGS(nf))
1151 
1152 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add);
1153 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add_disposed);
1154 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del);
1155 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del_disposed);
1156 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_in_use);
1157 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_writeback);
1158 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_referenced);
1159 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_disposed);
1160 
1161 DECLARE_EVENT_CLASS(nfsd_file_lruwalk_class,
1162 	TP_PROTO(
1163 		unsigned long removed,
1164 		unsigned long remaining
1165 	),
1166 	TP_ARGS(removed, remaining),
1167 	TP_STRUCT__entry(
1168 		__field(unsigned long, removed)
1169 		__field(unsigned long, remaining)
1170 	),
1171 	TP_fast_assign(
1172 		__entry->removed = removed;
1173 		__entry->remaining = remaining;
1174 	),
1175 	TP_printk("%lu entries removed, %lu remaining",
1176 		__entry->removed, __entry->remaining)
1177 );
1178 
1179 #define DEFINE_NFSD_FILE_LRUWALK_EVENT(name)				\
1180 DEFINE_EVENT(nfsd_file_lruwalk_class, name,				\
1181 	TP_PROTO(							\
1182 		unsigned long removed,					\
1183 		unsigned long remaining					\
1184 	),								\
1185 	TP_ARGS(removed, remaining))
1186 
1187 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed);
1188 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed);
1189 
1190 TRACE_EVENT(nfsd_file_close,
1191 	TP_PROTO(
1192 		const struct inode *inode
1193 	),
1194 	TP_ARGS(inode),
1195 	TP_STRUCT__entry(
1196 		__field(const void *, inode)
1197 	),
1198 	TP_fast_assign(
1199 		__entry->inode = inode;
1200 	),
1201 	TP_printk("inode=%p",
1202 		__entry->inode
1203 	)
1204 );
1205 
1206 #include "cache.h"
1207 
1208 TRACE_DEFINE_ENUM(RC_DROPIT);
1209 TRACE_DEFINE_ENUM(RC_REPLY);
1210 TRACE_DEFINE_ENUM(RC_DOIT);
1211 
1212 #define show_drc_retval(x)						\
1213 	__print_symbolic(x,						\
1214 		{ RC_DROPIT, "DROPIT" },				\
1215 		{ RC_REPLY, "REPLY" },					\
1216 		{ RC_DOIT, "DOIT" })
1217 
1218 TRACE_EVENT(nfsd_drc_found,
1219 	TP_PROTO(
1220 		const struct nfsd_net *nn,
1221 		const struct svc_rqst *rqstp,
1222 		int result
1223 	),
1224 	TP_ARGS(nn, rqstp, result),
1225 	TP_STRUCT__entry(
1226 		__field(unsigned long long, boot_time)
1227 		__field(unsigned long, result)
1228 		__field(u32, xid)
1229 	),
1230 	TP_fast_assign(
1231 		__entry->boot_time = nn->boot_time;
1232 		__entry->result = result;
1233 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
1234 	),
1235 	TP_printk("boot_time=%16llx xid=0x%08x result=%s",
1236 		__entry->boot_time, __entry->xid,
1237 		show_drc_retval(__entry->result))
1238 
1239 );
1240 
1241 TRACE_EVENT(nfsd_drc_mismatch,
1242 	TP_PROTO(
1243 		const struct nfsd_net *nn,
1244 		const struct nfsd_cacherep *key,
1245 		const struct nfsd_cacherep *rp
1246 	),
1247 	TP_ARGS(nn, key, rp),
1248 	TP_STRUCT__entry(
1249 		__field(unsigned long long, boot_time)
1250 		__field(u32, xid)
1251 		__field(u32, cached)
1252 		__field(u32, ingress)
1253 	),
1254 	TP_fast_assign(
1255 		__entry->boot_time = nn->boot_time;
1256 		__entry->xid = be32_to_cpu(key->c_key.k_xid);
1257 		__entry->cached = (__force u32)key->c_key.k_csum;
1258 		__entry->ingress = (__force u32)rp->c_key.k_csum;
1259 	),
1260 	TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x",
1261 		__entry->boot_time, __entry->xid, __entry->cached,
1262 		__entry->ingress)
1263 );
1264 
1265 TRACE_EVENT_CONDITION(nfsd_drc_gc,
1266 	TP_PROTO(
1267 		const struct nfsd_net *nn,
1268 		unsigned long freed
1269 	),
1270 	TP_ARGS(nn, freed),
1271 	TP_CONDITION(freed > 0),
1272 	TP_STRUCT__entry(
1273 		__field(unsigned long long, boot_time)
1274 		__field(unsigned long, freed)
1275 		__field(int, total)
1276 	),
1277 	TP_fast_assign(
1278 		__entry->boot_time = nn->boot_time;
1279 		__entry->freed = freed;
1280 		__entry->total = atomic_read(&nn->num_drc_entries);
1281 	),
1282 	TP_printk("boot_time=%16llx total=%d freed=%lu",
1283 		__entry->boot_time, __entry->total, __entry->freed
1284 	)
1285 );
1286 
1287 TRACE_EVENT(nfsd_cb_args,
1288 	TP_PROTO(
1289 		const struct nfs4_client *clp,
1290 		const struct nfs4_cb_conn *conn
1291 	),
1292 	TP_ARGS(clp, conn),
1293 	TP_STRUCT__entry(
1294 		__field(u32, cl_boot)
1295 		__field(u32, cl_id)
1296 		__field(u32, prog)
1297 		__field(u32, ident)
1298 		__sockaddr(addr, conn->cb_addrlen)
1299 	),
1300 	TP_fast_assign(
1301 		__entry->cl_boot = clp->cl_clientid.cl_boot;
1302 		__entry->cl_id = clp->cl_clientid.cl_id;
1303 		__entry->prog = conn->cb_prog;
1304 		__entry->ident = conn->cb_ident;
1305 		__assign_sockaddr(addr, &conn->cb_addr, conn->cb_addrlen);
1306 	),
1307 	TP_printk("addr=%pISpc client %08x:%08x prog=%u ident=%u",
1308 		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1309 		__entry->prog, __entry->ident)
1310 );
1311 
1312 TRACE_EVENT(nfsd_cb_nodelegs,
1313 	TP_PROTO(const struct nfs4_client *clp),
1314 	TP_ARGS(clp),
1315 	TP_STRUCT__entry(
1316 		__field(u32, cl_boot)
1317 		__field(u32, cl_id)
1318 	),
1319 	TP_fast_assign(
1320 		__entry->cl_boot = clp->cl_clientid.cl_boot;
1321 		__entry->cl_id = clp->cl_clientid.cl_id;
1322 	),
1323 	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
1324 )
1325 
1326 #define show_cb_state(val)						\
1327 	__print_symbolic(val,						\
1328 		{ NFSD4_CB_UP,		"UP" },				\
1329 		{ NFSD4_CB_UNKNOWN,	"UNKNOWN" },			\
1330 		{ NFSD4_CB_DOWN,	"DOWN" },			\
1331 		{ NFSD4_CB_FAULT,	"FAULT"})
1332 
1333 DECLARE_EVENT_CLASS(nfsd_cb_class,
1334 	TP_PROTO(const struct nfs4_client *clp),
1335 	TP_ARGS(clp),
1336 	TP_STRUCT__entry(
1337 		__field(unsigned long, state)
1338 		__field(u32, cl_boot)
1339 		__field(u32, cl_id)
1340 		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1341 	),
1342 	TP_fast_assign(
1343 		__entry->state = clp->cl_cb_state;
1344 		__entry->cl_boot = clp->cl_clientid.cl_boot;
1345 		__entry->cl_id = clp->cl_clientid.cl_id;
1346 		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1347 				  clp->cl_cb_conn.cb_addrlen)
1348 	),
1349 	TP_printk("addr=%pISpc client %08x:%08x state=%s",
1350 		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1351 		show_cb_state(__entry->state))
1352 );
1353 
1354 #define DEFINE_NFSD_CB_EVENT(name)			\
1355 DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name,		\
1356 	TP_PROTO(const struct nfs4_client *clp),	\
1357 	TP_ARGS(clp))
1358 
1359 DEFINE_NFSD_CB_EVENT(state);
1360 DEFINE_NFSD_CB_EVENT(probe);
1361 DEFINE_NFSD_CB_EVENT(lost);
1362 DEFINE_NFSD_CB_EVENT(shutdown);
1363 
1364 TRACE_DEFINE_ENUM(RPC_AUTH_NULL);
1365 TRACE_DEFINE_ENUM(RPC_AUTH_UNIX);
1366 TRACE_DEFINE_ENUM(RPC_AUTH_GSS);
1367 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5);
1368 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I);
1369 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P);
1370 
1371 #define show_nfsd_authflavor(val)					\
1372 	__print_symbolic(val,						\
1373 		{ RPC_AUTH_NULL,		"none" },		\
1374 		{ RPC_AUTH_UNIX,		"sys" },		\
1375 		{ RPC_AUTH_GSS,			"gss" },		\
1376 		{ RPC_AUTH_GSS_KRB5,		"krb5" },		\
1377 		{ RPC_AUTH_GSS_KRB5I,		"krb5i" },		\
1378 		{ RPC_AUTH_GSS_KRB5P,		"krb5p" })
1379 
1380 TRACE_EVENT(nfsd_cb_setup,
1381 	TP_PROTO(const struct nfs4_client *clp,
1382 		 const char *netid,
1383 		 rpc_authflavor_t authflavor
1384 	),
1385 	TP_ARGS(clp, netid, authflavor),
1386 	TP_STRUCT__entry(
1387 		__field(u32, cl_boot)
1388 		__field(u32, cl_id)
1389 		__field(unsigned long, authflavor)
1390 		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1391 		__string(netid, netid)
1392 	),
1393 	TP_fast_assign(
1394 		__entry->cl_boot = clp->cl_clientid.cl_boot;
1395 		__entry->cl_id = clp->cl_clientid.cl_id;
1396 		__assign_str(netid, netid);
1397 		__entry->authflavor = authflavor;
1398 		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1399 				  clp->cl_cb_conn.cb_addrlen)
1400 	),
1401 	TP_printk("addr=%pISpc client %08x:%08x proto=%s flavor=%s",
1402 		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1403 		__get_str(netid), show_nfsd_authflavor(__entry->authflavor))
1404 );
1405 
1406 TRACE_EVENT(nfsd_cb_setup_err,
1407 	TP_PROTO(
1408 		const struct nfs4_client *clp,
1409 		long error
1410 	),
1411 	TP_ARGS(clp, error),
1412 	TP_STRUCT__entry(
1413 		__field(long, error)
1414 		__field(u32, cl_boot)
1415 		__field(u32, cl_id)
1416 		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1417 	),
1418 	TP_fast_assign(
1419 		__entry->error = error;
1420 		__entry->cl_boot = clp->cl_clientid.cl_boot;
1421 		__entry->cl_id = clp->cl_clientid.cl_id;
1422 		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1423 				  clp->cl_cb_conn.cb_addrlen)
1424 	),
1425 	TP_printk("addr=%pISpc client %08x:%08x error=%ld",
1426 		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1427 		__entry->error)
1428 );
1429 
1430 TRACE_EVENT_CONDITION(nfsd_cb_recall,
1431 	TP_PROTO(
1432 		const struct nfs4_stid *stid
1433 	),
1434 	TP_ARGS(stid),
1435 	TP_CONDITION(stid->sc_client),
1436 	TP_STRUCT__entry(
1437 		__field(u32, cl_boot)
1438 		__field(u32, cl_id)
1439 		__field(u32, si_id)
1440 		__field(u32, si_generation)
1441 		__sockaddr(addr, stid->sc_client->cl_cb_conn.cb_addrlen)
1442 	),
1443 	TP_fast_assign(
1444 		const stateid_t *stp = &stid->sc_stateid;
1445 		const struct nfs4_client *clp = stid->sc_client;
1446 
1447 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1448 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1449 		__entry->si_id = stp->si_opaque.so_id;
1450 		__entry->si_generation = stp->si_generation;
1451 		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1452 				  clp->cl_cb_conn.cb_addrlen)
1453 	),
1454 	TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x",
1455 		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1456 		__entry->si_id, __entry->si_generation)
1457 );
1458 
1459 TRACE_EVENT(nfsd_cb_notify_lock,
1460 	TP_PROTO(
1461 		const struct nfs4_lockowner *lo,
1462 		const struct nfsd4_blocked_lock *nbl
1463 	),
1464 	TP_ARGS(lo, nbl),
1465 	TP_STRUCT__entry(
1466 		__field(u32, cl_boot)
1467 		__field(u32, cl_id)
1468 		__field(u32, fh_hash)
1469 		__sockaddr(addr, lo->lo_owner.so_client->cl_cb_conn.cb_addrlen)
1470 	),
1471 	TP_fast_assign(
1472 		const struct nfs4_client *clp = lo->lo_owner.so_client;
1473 
1474 		__entry->cl_boot = clp->cl_clientid.cl_boot;
1475 		__entry->cl_id = clp->cl_clientid.cl_id;
1476 		__entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh);
1477 		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1478 				  clp->cl_cb_conn.cb_addrlen)
1479 	),
1480 	TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x",
1481 		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1482 		__entry->fh_hash)
1483 );
1484 
1485 TRACE_EVENT(nfsd_cb_offload,
1486 	TP_PROTO(
1487 		const struct nfs4_client *clp,
1488 		const stateid_t *stp,
1489 		const struct knfsd_fh *fh,
1490 		u64 count,
1491 		__be32 status
1492 	),
1493 	TP_ARGS(clp, stp, fh, count, status),
1494 	TP_STRUCT__entry(
1495 		__field(u32, cl_boot)
1496 		__field(u32, cl_id)
1497 		__field(u32, si_id)
1498 		__field(u32, si_generation)
1499 		__field(u32, fh_hash)
1500 		__field(int, status)
1501 		__field(u64, count)
1502 		__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
1503 	),
1504 	TP_fast_assign(
1505 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1506 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1507 		__entry->si_id = stp->si_opaque.so_id;
1508 		__entry->si_generation = stp->si_generation;
1509 		__entry->fh_hash = knfsd_fh_hash(fh);
1510 		__entry->status = be32_to_cpu(status);
1511 		__entry->count = count;
1512 		__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
1513 				  clp->cl_cb_conn.cb_addrlen)
1514 	),
1515 	TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x fh_hash=0x%08x count=%llu status=%d",
1516 		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1517 		__entry->si_id, __entry->si_generation,
1518 		__entry->fh_hash, __entry->count, __entry->status)
1519 );
1520 
1521 TRACE_EVENT(nfsd_cb_recall_any,
1522 	TP_PROTO(
1523 		const struct nfsd4_cb_recall_any *ra
1524 	),
1525 	TP_ARGS(ra),
1526 	TP_STRUCT__entry(
1527 		__field(u32, cl_boot)
1528 		__field(u32, cl_id)
1529 		__field(u32, keep)
1530 		__field(unsigned long, bmval0)
1531 		__sockaddr(addr, ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen)
1532 	),
1533 	TP_fast_assign(
1534 		__entry->cl_boot = ra->ra_cb.cb_clp->cl_clientid.cl_boot;
1535 		__entry->cl_id = ra->ra_cb.cb_clp->cl_clientid.cl_id;
1536 		__entry->keep = ra->ra_keep;
1537 		__entry->bmval0 = ra->ra_bmval[0];
1538 		__assign_sockaddr(addr, &ra->ra_cb.cb_clp->cl_addr,
1539 				  ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen);
1540 	),
1541 	TP_printk("addr=%pISpc client %08x:%08x keep=%u bmval0=%s",
1542 		__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1543 		__entry->keep, show_rca_mask(__entry->bmval0)
1544 	)
1545 );
1546 
1547 DECLARE_EVENT_CLASS(nfsd_cb_done_class,
1548 	TP_PROTO(
1549 		const stateid_t *stp,
1550 		const struct rpc_task *task
1551 	),
1552 	TP_ARGS(stp, task),
1553 	TP_STRUCT__entry(
1554 		__field(u32, cl_boot)
1555 		__field(u32, cl_id)
1556 		__field(u32, si_id)
1557 		__field(u32, si_generation)
1558 		__field(int, status)
1559 	),
1560 	TP_fast_assign(
1561 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1562 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
1563 		__entry->si_id = stp->si_opaque.so_id;
1564 		__entry->si_generation = stp->si_generation;
1565 		__entry->status = task->tk_status;
1566 	),
1567 	TP_printk("client %08x:%08x stateid %08x:%08x status=%d",
1568 		__entry->cl_boot, __entry->cl_id, __entry->si_id,
1569 		__entry->si_generation, __entry->status
1570 	)
1571 );
1572 
1573 #define DEFINE_NFSD_CB_DONE_EVENT(name)			\
1574 DEFINE_EVENT(nfsd_cb_done_class, name,			\
1575 	TP_PROTO(					\
1576 		const stateid_t *stp,			\
1577 		const struct rpc_task *task		\
1578 	),						\
1579 	TP_ARGS(stp, task))
1580 
1581 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_recall_done);
1582 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_notify_lock_done);
1583 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_layout_done);
1584 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_offload_done);
1585 
1586 TRACE_EVENT(nfsd_cb_recall_any_done,
1587 	TP_PROTO(
1588 		const struct nfsd4_callback *cb,
1589 		const struct rpc_task *task
1590 	),
1591 	TP_ARGS(cb, task),
1592 	TP_STRUCT__entry(
1593 		__field(u32, cl_boot)
1594 		__field(u32, cl_id)
1595 		__field(int, status)
1596 	),
1597 	TP_fast_assign(
1598 		__entry->status = task->tk_status;
1599 		__entry->cl_boot = cb->cb_clp->cl_clientid.cl_boot;
1600 		__entry->cl_id = cb->cb_clp->cl_clientid.cl_id;
1601 	),
1602 	TP_printk("client %08x:%08x status=%d",
1603 		__entry->cl_boot, __entry->cl_id, __entry->status
1604 	)
1605 );
1606 
1607 TRACE_EVENT(nfsd_ctl_unlock_ip,
1608 	TP_PROTO(
1609 		const struct net *net,
1610 		const char *address
1611 	),
1612 	TP_ARGS(net, address),
1613 	TP_STRUCT__entry(
1614 		__field(unsigned int, netns_ino)
1615 		__string(address, address)
1616 	),
1617 	TP_fast_assign(
1618 		__entry->netns_ino = net->ns.inum;
1619 		__assign_str(address, address);
1620 	),
1621 	TP_printk("address=%s",
1622 		__get_str(address)
1623 	)
1624 );
1625 
1626 TRACE_EVENT(nfsd_ctl_unlock_fs,
1627 	TP_PROTO(
1628 		const struct net *net,
1629 		const char *path
1630 	),
1631 	TP_ARGS(net, path),
1632 	TP_STRUCT__entry(
1633 		__field(unsigned int, netns_ino)
1634 		__string(path, path)
1635 	),
1636 	TP_fast_assign(
1637 		__entry->netns_ino = net->ns.inum;
1638 		__assign_str(path, path);
1639 	),
1640 	TP_printk("path=%s",
1641 		__get_str(path)
1642 	)
1643 );
1644 
1645 TRACE_EVENT(nfsd_ctl_filehandle,
1646 	TP_PROTO(
1647 		const struct net *net,
1648 		const char *domain,
1649 		const char *path,
1650 		int maxsize
1651 	),
1652 	TP_ARGS(net, domain, path, maxsize),
1653 	TP_STRUCT__entry(
1654 		__field(unsigned int, netns_ino)
1655 		__field(int, maxsize)
1656 		__string(domain, domain)
1657 		__string(path, path)
1658 	),
1659 	TP_fast_assign(
1660 		__entry->netns_ino = net->ns.inum;
1661 		__entry->maxsize = maxsize;
1662 		__assign_str(domain, domain);
1663 		__assign_str(path, path);
1664 	),
1665 	TP_printk("domain=%s path=%s maxsize=%d",
1666 		__get_str(domain), __get_str(path), __entry->maxsize
1667 	)
1668 );
1669 
1670 TRACE_EVENT(nfsd_ctl_threads,
1671 	TP_PROTO(
1672 		const struct net *net,
1673 		int newthreads
1674 	),
1675 	TP_ARGS(net, newthreads),
1676 	TP_STRUCT__entry(
1677 		__field(unsigned int, netns_ino)
1678 		__field(int, newthreads)
1679 	),
1680 	TP_fast_assign(
1681 		__entry->netns_ino = net->ns.inum;
1682 		__entry->newthreads = newthreads;
1683 	),
1684 	TP_printk("newthreads=%d",
1685 		__entry->newthreads
1686 	)
1687 );
1688 
1689 TRACE_EVENT(nfsd_ctl_pool_threads,
1690 	TP_PROTO(
1691 		const struct net *net,
1692 		int pool,
1693 		int nrthreads
1694 	),
1695 	TP_ARGS(net, pool, nrthreads),
1696 	TP_STRUCT__entry(
1697 		__field(unsigned int, netns_ino)
1698 		__field(int, pool)
1699 		__field(int, nrthreads)
1700 	),
1701 	TP_fast_assign(
1702 		__entry->netns_ino = net->ns.inum;
1703 		__entry->pool = pool;
1704 		__entry->nrthreads = nrthreads;
1705 	),
1706 	TP_printk("pool=%d nrthreads=%d",
1707 		__entry->pool, __entry->nrthreads
1708 	)
1709 );
1710 
1711 TRACE_EVENT(nfsd_ctl_version,
1712 	TP_PROTO(
1713 		const struct net *net,
1714 		const char *mesg
1715 	),
1716 	TP_ARGS(net, mesg),
1717 	TP_STRUCT__entry(
1718 		__field(unsigned int, netns_ino)
1719 		__string(mesg, mesg)
1720 	),
1721 	TP_fast_assign(
1722 		__entry->netns_ino = net->ns.inum;
1723 		__assign_str(mesg, mesg);
1724 	),
1725 	TP_printk("%s",
1726 		__get_str(mesg)
1727 	)
1728 );
1729 
1730 TRACE_EVENT(nfsd_ctl_ports_addfd,
1731 	TP_PROTO(
1732 		const struct net *net,
1733 		int fd
1734 	),
1735 	TP_ARGS(net, fd),
1736 	TP_STRUCT__entry(
1737 		__field(unsigned int, netns_ino)
1738 		__field(int, fd)
1739 	),
1740 	TP_fast_assign(
1741 		__entry->netns_ino = net->ns.inum;
1742 		__entry->fd = fd;
1743 	),
1744 	TP_printk("fd=%d",
1745 		__entry->fd
1746 	)
1747 );
1748 
1749 TRACE_EVENT(nfsd_ctl_ports_addxprt,
1750 	TP_PROTO(
1751 		const struct net *net,
1752 		const char *transport,
1753 		int port
1754 	),
1755 	TP_ARGS(net, transport, port),
1756 	TP_STRUCT__entry(
1757 		__field(unsigned int, netns_ino)
1758 		__field(int, port)
1759 		__string(transport, transport)
1760 	),
1761 	TP_fast_assign(
1762 		__entry->netns_ino = net->ns.inum;
1763 		__entry->port = port;
1764 		__assign_str(transport, transport);
1765 	),
1766 	TP_printk("transport=%s port=%d",
1767 		__get_str(transport), __entry->port
1768 	)
1769 );
1770 
1771 TRACE_EVENT(nfsd_ctl_maxblksize,
1772 	TP_PROTO(
1773 		const struct net *net,
1774 		int bsize
1775 	),
1776 	TP_ARGS(net, bsize),
1777 	TP_STRUCT__entry(
1778 		__field(unsigned int, netns_ino)
1779 		__field(int, bsize)
1780 	),
1781 	TP_fast_assign(
1782 		__entry->netns_ino = net->ns.inum;
1783 		__entry->bsize = bsize;
1784 	),
1785 	TP_printk("bsize=%d",
1786 		__entry->bsize
1787 	)
1788 );
1789 
1790 TRACE_EVENT(nfsd_ctl_maxconn,
1791 	TP_PROTO(
1792 		const struct net *net,
1793 		int maxconn
1794 	),
1795 	TP_ARGS(net, maxconn),
1796 	TP_STRUCT__entry(
1797 		__field(unsigned int, netns_ino)
1798 		__field(int, maxconn)
1799 	),
1800 	TP_fast_assign(
1801 		__entry->netns_ino = net->ns.inum;
1802 		__entry->maxconn = maxconn;
1803 	),
1804 	TP_printk("maxconn=%d",
1805 		__entry->maxconn
1806 	)
1807 );
1808 
1809 TRACE_EVENT(nfsd_ctl_time,
1810 	TP_PROTO(
1811 		const struct net *net,
1812 		const char *name,
1813 		size_t namelen,
1814 		int time
1815 	),
1816 	TP_ARGS(net, name, namelen, time),
1817 	TP_STRUCT__entry(
1818 		__field(unsigned int, netns_ino)
1819 		__field(int, time)
1820 		__string_len(name, name, namelen)
1821 	),
1822 	TP_fast_assign(
1823 		__entry->netns_ino = net->ns.inum;
1824 		__entry->time = time;
1825 		__assign_str_len(name, name, namelen);
1826 	),
1827 	TP_printk("file=%s time=%d\n",
1828 		__get_str(name), __entry->time
1829 	)
1830 );
1831 
1832 TRACE_EVENT(nfsd_ctl_recoverydir,
1833 	TP_PROTO(
1834 		const struct net *net,
1835 		const char *recdir
1836 	),
1837 	TP_ARGS(net, recdir),
1838 	TP_STRUCT__entry(
1839 		__field(unsigned int, netns_ino)
1840 		__string(recdir, recdir)
1841 	),
1842 	TP_fast_assign(
1843 		__entry->netns_ino = net->ns.inum;
1844 		__assign_str(recdir, recdir);
1845 	),
1846 	TP_printk("recdir=%s",
1847 		__get_str(recdir)
1848 	)
1849 );
1850 
1851 TRACE_EVENT(nfsd_end_grace,
1852 	TP_PROTO(
1853 		const struct net *net
1854 	),
1855 	TP_ARGS(net),
1856 	TP_STRUCT__entry(
1857 		__field(unsigned int, netns_ino)
1858 	),
1859 	TP_fast_assign(
1860 		__entry->netns_ino = net->ns.inum;
1861 	),
1862 	TP_printk("nn=%d", __entry->netns_ino
1863 	)
1864 );
1865 
1866 DECLARE_EVENT_CLASS(nfsd_copy_class,
1867 	TP_PROTO(
1868 		const struct nfsd4_copy *copy
1869 	),
1870 	TP_ARGS(copy),
1871 	TP_STRUCT__entry(
1872 		__field(bool, intra)
1873 		__field(bool, async)
1874 		__field(u32, src_cl_boot)
1875 		__field(u32, src_cl_id)
1876 		__field(u32, src_so_id)
1877 		__field(u32, src_si_generation)
1878 		__field(u32, dst_cl_boot)
1879 		__field(u32, dst_cl_id)
1880 		__field(u32, dst_so_id)
1881 		__field(u32, dst_si_generation)
1882 		__field(u64, src_cp_pos)
1883 		__field(u64, dst_cp_pos)
1884 		__field(u64, cp_count)
1885 		__sockaddr(addr, sizeof(struct sockaddr_in6))
1886 	),
1887 	TP_fast_assign(
1888 		const stateid_t *src_stp = &copy->cp_src_stateid;
1889 		const stateid_t *dst_stp = &copy->cp_dst_stateid;
1890 
1891 		__entry->intra = test_bit(NFSD4_COPY_F_INTRA, &copy->cp_flags);
1892 		__entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
1893 		__entry->src_cl_boot = src_stp->si_opaque.so_clid.cl_boot;
1894 		__entry->src_cl_id = src_stp->si_opaque.so_clid.cl_id;
1895 		__entry->src_so_id = src_stp->si_opaque.so_id;
1896 		__entry->src_si_generation = src_stp->si_generation;
1897 		__entry->dst_cl_boot = dst_stp->si_opaque.so_clid.cl_boot;
1898 		__entry->dst_cl_id = dst_stp->si_opaque.so_clid.cl_id;
1899 		__entry->dst_so_id = dst_stp->si_opaque.so_id;
1900 		__entry->dst_si_generation = dst_stp->si_generation;
1901 		__entry->src_cp_pos = copy->cp_src_pos;
1902 		__entry->dst_cp_pos = copy->cp_dst_pos;
1903 		__entry->cp_count = copy->cp_count;
1904 		__assign_sockaddr(addr, &copy->cp_clp->cl_addr,
1905 				sizeof(struct sockaddr_in6));
1906 	),
1907 	TP_printk("client=%pISpc intra=%d async=%d "
1908 		"src_stateid[si_generation:0x%x cl_boot:0x%x cl_id:0x%x so_id:0x%x] "
1909 		"dst_stateid[si_generation:0x%x cl_boot:0x%x cl_id:0x%x so_id:0x%x] "
1910 		"cp_src_pos=%llu cp_dst_pos=%llu cp_count=%llu",
1911 		__get_sockaddr(addr), __entry->intra, __entry->async,
1912 		__entry->src_si_generation, __entry->src_cl_boot,
1913 		__entry->src_cl_id, __entry->src_so_id,
1914 		__entry->dst_si_generation, __entry->dst_cl_boot,
1915 		__entry->dst_cl_id, __entry->dst_so_id,
1916 		__entry->src_cp_pos, __entry->dst_cp_pos, __entry->cp_count
1917 	)
1918 );
1919 
1920 #define DEFINE_COPY_EVENT(name)				\
1921 DEFINE_EVENT(nfsd_copy_class, nfsd_copy_##name,	\
1922 	TP_PROTO(const struct nfsd4_copy *copy),	\
1923 	TP_ARGS(copy))
1924 
1925 DEFINE_COPY_EVENT(inter);
1926 DEFINE_COPY_EVENT(intra);
1927 DEFINE_COPY_EVENT(do_async);
1928 
1929 TRACE_EVENT(nfsd_copy_done,
1930 	TP_PROTO(
1931 		const struct nfsd4_copy *copy,
1932 		__be32 status
1933 	),
1934 	TP_ARGS(copy, status),
1935 	TP_STRUCT__entry(
1936 		__field(int, status)
1937 		__field(bool, intra)
1938 		__field(bool, async)
1939 		__sockaddr(addr, sizeof(struct sockaddr_in6))
1940 	),
1941 	TP_fast_assign(
1942 		__entry->status = be32_to_cpu(status);
1943 		__entry->intra = test_bit(NFSD4_COPY_F_INTRA, &copy->cp_flags);
1944 		__entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
1945 		__assign_sockaddr(addr, &copy->cp_clp->cl_addr,
1946 				sizeof(struct sockaddr_in6));
1947 	),
1948 	TP_printk("addr=%pISpc status=%d intra=%d async=%d ",
1949 		__get_sockaddr(addr), __entry->status, __entry->intra, __entry->async
1950 	)
1951 );
1952 
1953 #endif /* _NFSD_TRACE_H */
1954 
1955 #undef TRACE_INCLUDE_PATH
1956 #define TRACE_INCLUDE_PATH .
1957 #define TRACE_INCLUDE_FILE trace
1958 #include <trace/define_trace.h>
1959