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