blob: c4cf56327843024ef0acac0c5211dd3b1903962c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Christoph Hellwig31ef83d2014-08-16 19:02:22 -05002/*
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>
Chuck Lever87915452021-10-22 16:17:03 -040012
Trond Myklebustcf749f32020-03-01 18:21:40 -050013#include "export.h"
Jeff Layton6e8b50d2015-11-17 06:52:23 -050014#include "nfsfh.h"
15
Chuck Lever0dfdad12020-10-19 13:00:29 -040016#define NFSD_TRACE_PROC_ARG_FIELDS \
17 __field(unsigned int, netns_ino) \
18 __field(u32, xid) \
19 __array(unsigned char, server, sizeof(struct sockaddr_in6)) \
20 __array(unsigned char, client, sizeof(struct sockaddr_in6))
21
22#define NFSD_TRACE_PROC_ARG_ASSIGNMENTS \
23 do { \
24 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; \
25 __entry->xid = be32_to_cpu(rqstp->rq_xid); \
26 memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \
27 rqstp->rq_xprt->xpt_locallen); \
28 memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \
29 rqstp->rq_xprt->xpt_remotelen); \
30 } while (0);
31
Chuck Lever08281342020-11-21 11:36:42 -050032#define NFSD_TRACE_PROC_RES_FIELDS \
33 __field(unsigned int, netns_ino) \
34 __field(u32, xid) \
35 __field(unsigned long, status) \
36 __array(unsigned char, server, sizeof(struct sockaddr_in6)) \
37 __array(unsigned char, client, sizeof(struct sockaddr_in6))
38
39#define NFSD_TRACE_PROC_RES_ASSIGNMENTS(error) \
40 do { \
41 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; \
42 __entry->xid = be32_to_cpu(rqstp->rq_xid); \
43 __entry->status = be32_to_cpu(error); \
44 memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \
45 rqstp->rq_xprt->xpt_locallen); \
46 memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \
47 rqstp->rq_xprt->xpt_remotelen); \
48 } while (0);
49
Chuck Lever70e94d72021-10-21 12:11:45 -040050DECLARE_EVENT_CLASS(nfsd_xdr_err_class,
Chuck Lever0dfdad12020-10-19 13:00:29 -040051 TP_PROTO(
52 const struct svc_rqst *rqstp
53 ),
54 TP_ARGS(rqstp),
55 TP_STRUCT__entry(
56 NFSD_TRACE_PROC_ARG_FIELDS
57
58 __field(u32, vers)
59 __field(u32, proc)
60 ),
61 TP_fast_assign(
62 NFSD_TRACE_PROC_ARG_ASSIGNMENTS
63
64 __entry->vers = rqstp->rq_vers;
65 __entry->proc = rqstp->rq_proc;
66 ),
67 TP_printk("xid=0x%08x vers=%u proc=%u",
68 __entry->xid, __entry->vers, __entry->proc
69 )
70);
71
Chuck Lever70e94d72021-10-21 12:11:45 -040072#define DEFINE_NFSD_XDR_ERR_EVENT(name) \
73DEFINE_EVENT(nfsd_xdr_err_class, nfsd_##name##_err, \
74 TP_PROTO(const struct svc_rqst *rqstp), \
75 TP_ARGS(rqstp))
Chuck Lever0dfdad12020-10-19 13:00:29 -040076
Chuck Lever70e94d72021-10-21 12:11:45 -040077DEFINE_NFSD_XDR_ERR_EVENT(garbage_args);
78DEFINE_NFSD_XDR_ERR_EVENT(cant_encode);
Chuck Lever0dfdad12020-10-19 13:00:29 -040079
Chuck Leverb76278a2020-08-19 12:56:40 -040080#define show_nfsd_may_flags(x) \
81 __print_flags(x, "|", \
82 { NFSD_MAY_EXEC, "EXEC" }, \
83 { NFSD_MAY_WRITE, "WRITE" }, \
84 { NFSD_MAY_READ, "READ" }, \
85 { NFSD_MAY_SATTR, "SATTR" }, \
86 { NFSD_MAY_TRUNC, "TRUNC" }, \
87 { NFSD_MAY_LOCK, "LOCK" }, \
88 { NFSD_MAY_OWNER_OVERRIDE, "OWNER_OVERRIDE" }, \
89 { NFSD_MAY_LOCAL_ACCESS, "LOCAL_ACCESS" }, \
90 { NFSD_MAY_BYPASS_GSS_ON_ROOT, "BYPASS_GSS_ON_ROOT" }, \
91 { NFSD_MAY_NOT_BREAK_LEASE, "NOT_BREAK_LEASE" }, \
92 { NFSD_MAY_BYPASS_GSS, "BYPASS_GSS" }, \
93 { NFSD_MAY_READ_IF_EXEC, "READ_IF_EXEC" }, \
94 { NFSD_MAY_64BIT_COOKIE, "64BIT_COOKIE" })
95
Chuck Leverfff40802018-03-27 10:53:54 -040096TRACE_EVENT(nfsd_compound,
97 TP_PROTO(const struct svc_rqst *rqst,
98 u32 args_opcnt),
99 TP_ARGS(rqst, args_opcnt),
100 TP_STRUCT__entry(
101 __field(u32, xid)
102 __field(u32, args_opcnt)
103 ),
104 TP_fast_assign(
105 __entry->xid = be32_to_cpu(rqst->rq_xid);
106 __entry->args_opcnt = args_opcnt;
107 ),
108 TP_printk("xid=0x%08x opcnt=%u",
109 __entry->xid, __entry->args_opcnt)
110)
111
112TRACE_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
Chuck Lever08281342020-11-21 11:36:42 -0500135TRACE_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
163TRACE_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
Trond Myklebustf01274a2020-03-01 18:21:39 -0500185DECLARE_EVENT_CLASS(nfsd_fh_err_class,
186 TP_PROTO(struct svc_rqst *rqstp,
187 struct svc_fh *fhp,
188 int status),
189 TP_ARGS(rqstp, fhp, status),
190 TP_STRUCT__entry(
191 __field(u32, xid)
192 __field(u32, fh_hash)
193 __field(int, status)
194 ),
195 TP_fast_assign(
196 __entry->xid = be32_to_cpu(rqstp->rq_xid);
197 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
198 __entry->status = status;
199 ),
200 TP_printk("xid=0x%08x fh_hash=0x%08x status=%d",
201 __entry->xid, __entry->fh_hash,
202 __entry->status)
203)
204
205#define DEFINE_NFSD_FH_ERR_EVENT(name) \
206DEFINE_EVENT(nfsd_fh_err_class, nfsd_##name, \
207 TP_PROTO(struct svc_rqst *rqstp, \
208 struct svc_fh *fhp, \
209 int status), \
210 TP_ARGS(rqstp, fhp, status))
211
212DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport);
213DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle);
214
Trond Myklebustcf749f32020-03-01 18:21:40 -0500215TRACE_EVENT(nfsd_exp_find_key,
216 TP_PROTO(const struct svc_expkey *key,
217 int status),
218 TP_ARGS(key, status),
219 TP_STRUCT__entry(
220 __field(int, fsidtype)
221 __array(u32, fsid, 6)
222 __string(auth_domain, key->ek_client->name)
223 __field(int, status)
224 ),
225 TP_fast_assign(
226 __entry->fsidtype = key->ek_fsidtype;
227 memcpy(__entry->fsid, key->ek_fsid, 4*6);
228 __assign_str(auth_domain, key->ek_client->name);
229 __entry->status = status;
230 ),
231 TP_printk("fsid=%x::%s domain=%s status=%d",
232 __entry->fsidtype,
233 __print_array(__entry->fsid, 6, 4),
234 __get_str(auth_domain),
235 __entry->status
236 )
237);
238
Trond Myklebust6a30e472020-03-01 18:21:41 -0500239TRACE_EVENT(nfsd_expkey_update,
240 TP_PROTO(const struct svc_expkey *key, const char *exp_path),
241 TP_ARGS(key, exp_path),
242 TP_STRUCT__entry(
243 __field(int, fsidtype)
244 __array(u32, fsid, 6)
245 __string(auth_domain, key->ek_client->name)
246 __string(path, exp_path)
247 __field(bool, cache)
248 ),
249 TP_fast_assign(
250 __entry->fsidtype = key->ek_fsidtype;
251 memcpy(__entry->fsid, key->ek_fsid, 4*6);
252 __assign_str(auth_domain, key->ek_client->name);
253 __assign_str(path, exp_path);
254 __entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
255 ),
256 TP_printk("fsid=%x::%s domain=%s path=%s cache=%s",
257 __entry->fsidtype,
258 __print_array(__entry->fsid, 6, 4),
259 __get_str(auth_domain),
260 __get_str(path),
261 __entry->cache ? "pos" : "neg"
262 )
263);
264
Trond Myklebustcf749f32020-03-01 18:21:40 -0500265TRACE_EVENT(nfsd_exp_get_by_name,
266 TP_PROTO(const struct svc_export *key,
267 int status),
268 TP_ARGS(key, status),
269 TP_STRUCT__entry(
270 __string(path, key->ex_path.dentry->d_name.name)
271 __string(auth_domain, key->ex_client->name)
272 __field(int, status)
273 ),
274 TP_fast_assign(
275 __assign_str(path, key->ex_path.dentry->d_name.name);
276 __assign_str(auth_domain, key->ex_client->name);
277 __entry->status = status;
278 ),
279 TP_printk("path=%s domain=%s status=%d",
280 __get_str(path),
281 __get_str(auth_domain),
282 __entry->status
283 )
284);
285
Trond Myklebust6a30e472020-03-01 18:21:41 -0500286TRACE_EVENT(nfsd_export_update,
287 TP_PROTO(const struct svc_export *key),
288 TP_ARGS(key),
289 TP_STRUCT__entry(
290 __string(path, key->ex_path.dentry->d_name.name)
291 __string(auth_domain, key->ex_client->name)
292 __field(bool, cache)
293 ),
294 TP_fast_assign(
295 __assign_str(path, key->ex_path.dentry->d_name.name);
296 __assign_str(auth_domain, key->ex_client->name);
297 __entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
298 ),
299 TP_printk("path=%s domain=%s cache=%s",
300 __get_str(path),
301 __get_str(auth_domain),
302 __entry->cache ? "pos" : "neg"
303 )
304);
305
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500306DECLARE_EVENT_CLASS(nfsd_io_class,
307 TP_PROTO(struct svc_rqst *rqstp,
308 struct svc_fh *fhp,
309 loff_t offset,
Chuck Lever79e0b4e2018-03-27 10:52:57 -0400310 unsigned long len),
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500311 TP_ARGS(rqstp, fhp, offset, len),
312 TP_STRUCT__entry(
Chuck Leverafa720a2018-03-27 10:52:43 -0400313 __field(u32, xid)
314 __field(u32, fh_hash)
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500315 __field(loff_t, offset)
Chuck Lever79e0b4e2018-03-27 10:52:57 -0400316 __field(unsigned long, len)
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500317 ),
318 TP_fast_assign(
Chuck Leverafa720a2018-03-27 10:52:43 -0400319 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Lever79e0b4e2018-03-27 10:52:57 -0400320 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500321 __entry->offset = offset;
322 __entry->len = len;
323 ),
Chuck Lever79e0b4e2018-03-27 10:52:57 -0400324 TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld len=%lu",
Chuck Leverafa720a2018-03-27 10:52:43 -0400325 __entry->xid, __entry->fh_hash,
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500326 __entry->offset, __entry->len)
327)
328
329#define DEFINE_NFSD_IO_EVENT(name) \
Chuck Leverf394b622018-03-27 10:53:11 -0400330DEFINE_EVENT(nfsd_io_class, nfsd_##name, \
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500331 TP_PROTO(struct svc_rqst *rqstp, \
332 struct svc_fh *fhp, \
333 loff_t offset, \
Chuck Lever79e0b4e2018-03-27 10:52:57 -0400334 unsigned long len), \
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500335 TP_ARGS(rqstp, fhp, offset, len))
336
337DEFINE_NFSD_IO_EVENT(read_start);
Chuck Lever87c59422018-03-28 13:29:11 -0400338DEFINE_NFSD_IO_EVENT(read_splice);
339DEFINE_NFSD_IO_EVENT(read_vector);
Jeff Layton6e8b50d2015-11-17 06:52:23 -0500340DEFINE_NFSD_IO_EVENT(read_io_done);
341DEFINE_NFSD_IO_EVENT(read_done);
342DEFINE_NFSD_IO_EVENT(write_start);
343DEFINE_NFSD_IO_EVENT(write_opened);
344DEFINE_NFSD_IO_EVENT(write_io_done);
345DEFINE_NFSD_IO_EVENT(write_done);
Christoph Hellwig31ef83d2014-08-16 19:02:22 -0500346
Chuck Leverd890be12018-03-27 10:53:27 -0400347DECLARE_EVENT_CLASS(nfsd_err_class,
348 TP_PROTO(struct svc_rqst *rqstp,
349 struct svc_fh *fhp,
350 loff_t offset,
351 int status),
352 TP_ARGS(rqstp, fhp, offset, status),
353 TP_STRUCT__entry(
354 __field(u32, xid)
355 __field(u32, fh_hash)
356 __field(loff_t, offset)
357 __field(int, status)
358 ),
359 TP_fast_assign(
360 __entry->xid = be32_to_cpu(rqstp->rq_xid);
361 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
362 __entry->offset = offset;
363 __entry->status = status;
364 ),
365 TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d",
366 __entry->xid, __entry->fh_hash,
367 __entry->offset, __entry->status)
368)
369
370#define DEFINE_NFSD_ERR_EVENT(name) \
371DEFINE_EVENT(nfsd_err_class, nfsd_##name, \
372 TP_PROTO(struct svc_rqst *rqstp, \
373 struct svc_fh *fhp, \
374 loff_t offset, \
375 int len), \
376 TP_ARGS(rqstp, fhp, offset, len))
377
Chuck Lever87c59422018-03-28 13:29:11 -0400378DEFINE_NFSD_ERR_EVENT(read_err);
Chuck Leverd890be12018-03-27 10:53:27 -0400379DEFINE_NFSD_ERR_EVENT(write_err);
380
Chuck Lever6019ce072021-03-05 13:57:40 -0500381TRACE_EVENT(nfsd_dirent,
382 TP_PROTO(struct svc_fh *fhp,
383 u64 ino,
384 const char *name,
385 int namlen),
386 TP_ARGS(fhp, ino, name, namlen),
387 TP_STRUCT__entry(
388 __field(u32, fh_hash)
389 __field(u64, ino)
Chuck Lever408c0de2021-05-12 09:39:06 -0400390 __string_len(name, name, namlen)
Chuck Lever6019ce072021-03-05 13:57:40 -0500391 ),
392 TP_fast_assign(
393 __entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0;
394 __entry->ino = ino;
Chuck Lever408c0de2021-05-12 09:39:06 -0400395 __assign_str_len(name, name, namlen)
Chuck Lever6019ce072021-03-05 13:57:40 -0500396 ),
Chuck Lever408c0de2021-05-12 09:39:06 -0400397 TP_printk("fh_hash=0x%08x ino=%llu name=%s",
398 __entry->fh_hash, __entry->ino, __get_str(name)
399 )
Chuck Lever6019ce072021-03-05 13:57:40 -0500400)
401
Trond Myklebusta2f4c3f2021-12-18 20:38:00 -0500402DECLARE_EVENT_CLASS(nfsd_copy_err_class,
403 TP_PROTO(struct svc_rqst *rqstp,
404 struct svc_fh *src_fhp,
405 loff_t src_offset,
406 struct svc_fh *dst_fhp,
407 loff_t dst_offset,
408 u64 count,
409 int status),
410 TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, count, status),
411 TP_STRUCT__entry(
412 __field(u32, xid)
413 __field(u32, src_fh_hash)
414 __field(loff_t, src_offset)
415 __field(u32, dst_fh_hash)
416 __field(loff_t, dst_offset)
417 __field(u64, count)
418 __field(int, status)
419 ),
420 TP_fast_assign(
421 __entry->xid = be32_to_cpu(rqstp->rq_xid);
422 __entry->src_fh_hash = knfsd_fh_hash(&src_fhp->fh_handle);
423 __entry->src_offset = src_offset;
424 __entry->dst_fh_hash = knfsd_fh_hash(&dst_fhp->fh_handle);
425 __entry->dst_offset = dst_offset;
426 __entry->count = count;
427 __entry->status = status;
428 ),
429 TP_printk("xid=0x%08x src_fh_hash=0x%08x src_offset=%lld "
430 "dst_fh_hash=0x%08x dst_offset=%lld "
431 "count=%llu status=%d",
432 __entry->xid, __entry->src_fh_hash, __entry->src_offset,
433 __entry->dst_fh_hash, __entry->dst_offset,
434 (unsigned long long)__entry->count,
435 __entry->status)
436)
437
438#define DEFINE_NFSD_COPY_ERR_EVENT(name) \
439DEFINE_EVENT(nfsd_copy_err_class, nfsd_##name, \
440 TP_PROTO(struct svc_rqst *rqstp, \
441 struct svc_fh *src_fhp, \
442 loff_t src_offset, \
443 struct svc_fh *dst_fhp, \
444 loff_t dst_offset, \
445 u64 count, \
446 int status), \
447 TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, \
448 count, status))
449
450DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err);
451
Jeff Layton825213e2015-10-03 08:19:57 -0400452#include "state.h"
Jeff Layton65294c12019-08-18 14:18:48 -0400453#include "filecache.h"
454#include "vfs.h"
Jeff Layton825213e2015-10-03 08:19:57 -0400455
Christoph Hellwig31ef83d2014-08-16 19:02:22 -0500456DECLARE_EVENT_CLASS(nfsd_stateid_class,
457 TP_PROTO(stateid_t *stp),
458 TP_ARGS(stp),
459 TP_STRUCT__entry(
460 __field(u32, cl_boot)
461 __field(u32, cl_id)
462 __field(u32, si_id)
463 __field(u32, si_generation)
464 ),
465 TP_fast_assign(
466 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
467 __entry->cl_id = stp->si_opaque.so_clid.cl_id;
468 __entry->si_id = stp->si_opaque.so_id;
469 __entry->si_generation = stp->si_generation;
470 ),
471 TP_printk("client %08x:%08x stateid %08x:%08x",
472 __entry->cl_boot,
473 __entry->cl_id,
474 __entry->si_id,
475 __entry->si_generation)
476)
477
478#define DEFINE_STATEID_EVENT(name) \
Chuck Leverf394b622018-03-27 10:53:11 -0400479DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \
Christoph Hellwig31ef83d2014-08-16 19:02:22 -0500480 TP_PROTO(stateid_t *stp), \
481 TP_ARGS(stp))
Chuck Leverdd5e3fb2020-04-05 11:42:29 -0400482
Christoph Hellwig31ef83d2014-08-16 19:02:22 -0500483DEFINE_STATEID_EVENT(layoutstate_alloc);
484DEFINE_STATEID_EVENT(layoutstate_unhash);
485DEFINE_STATEID_EVENT(layoutstate_free);
486DEFINE_STATEID_EVENT(layout_get_lookup_fail);
487DEFINE_STATEID_EVENT(layout_commit_lookup_fail);
488DEFINE_STATEID_EVENT(layout_return_lookup_fail);
489DEFINE_STATEID_EVENT(layout_recall);
490DEFINE_STATEID_EVENT(layout_recall_done);
491DEFINE_STATEID_EVENT(layout_recall_fail);
492DEFINE_STATEID_EVENT(layout_recall_release);
493
Hou Tao3caf9172020-08-28 15:02:55 +0800494DEFINE_STATEID_EVENT(open);
495DEFINE_STATEID_EVENT(deleg_read);
Chuck Leverdd5e3fb2020-04-05 11:42:29 -0400496DEFINE_STATEID_EVENT(deleg_recall);
497
498DECLARE_EVENT_CLASS(nfsd_stateseqid_class,
499 TP_PROTO(u32 seqid, const stateid_t *stp),
500 TP_ARGS(seqid, stp),
501 TP_STRUCT__entry(
502 __field(u32, seqid)
503 __field(u32, cl_boot)
504 __field(u32, cl_id)
505 __field(u32, si_id)
506 __field(u32, si_generation)
507 ),
508 TP_fast_assign(
509 __entry->seqid = seqid;
510 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
511 __entry->cl_id = stp->si_opaque.so_clid.cl_id;
512 __entry->si_id = stp->si_opaque.so_id;
513 __entry->si_generation = stp->si_generation;
514 ),
515 TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x",
516 __entry->seqid, __entry->cl_boot, __entry->cl_id,
517 __entry->si_id, __entry->si_generation)
518)
519
520#define DEFINE_STATESEQID_EVENT(name) \
521DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \
522 TP_PROTO(u32 seqid, const stateid_t *stp), \
523 TP_ARGS(seqid, stp))
524
525DEFINE_STATESEQID_EVENT(preprocess);
526DEFINE_STATESEQID_EVENT(open_confirm);
527
528DECLARE_EVENT_CLASS(nfsd_clientid_class,
529 TP_PROTO(const clientid_t *clid),
530 TP_ARGS(clid),
531 TP_STRUCT__entry(
532 __field(u32, cl_boot)
533 __field(u32, cl_id)
534 ),
535 TP_fast_assign(
536 __entry->cl_boot = clid->cl_boot;
537 __entry->cl_id = clid->cl_id;
538 ),
539 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
540)
541
542#define DEFINE_CLIENTID_EVENT(name) \
543DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \
544 TP_PROTO(const clientid_t *clid), \
545 TP_ARGS(clid))
546
Chuck Lever237f91c2021-05-14 15:56:13 -0400547DEFINE_CLIENTID_EVENT(expire_unconf);
Chuck Levercee8aa02021-05-14 15:55:54 -0400548DEFINE_CLIENTID_EVENT(reclaim_complete);
Chuck Lever7e3b32a2021-05-14 15:55:48 -0400549DEFINE_CLIENTID_EVENT(confirmed);
Chuck Leverc41a9b72021-05-14 15:56:00 -0400550DEFINE_CLIENTID_EVENT(destroyed);
Chuck Lever2958d2e2021-05-14 15:56:06 -0400551DEFINE_CLIENTID_EVENT(admin_expired);
552DEFINE_CLIENTID_EVENT(replaced);
Chuck Leverdd5e3fb2020-04-05 11:42:29 -0400553DEFINE_CLIENTID_EVENT(purged);
554DEFINE_CLIENTID_EVENT(renew);
555DEFINE_CLIENTID_EVENT(stale);
556
557DECLARE_EVENT_CLASS(nfsd_net_class,
558 TP_PROTO(const struct nfsd_net *nn),
559 TP_ARGS(nn),
560 TP_STRUCT__entry(
561 __field(unsigned long long, boot_time)
562 ),
563 TP_fast_assign(
564 __entry->boot_time = nn->boot_time;
565 ),
566 TP_printk("boot_time=%16llx", __entry->boot_time)
567)
568
569#define DEFINE_NET_EVENT(name) \
570DEFINE_EVENT(nfsd_net_class, nfsd_##name, \
571 TP_PROTO(const struct nfsd_net *nn), \
572 TP_ARGS(nn))
573
574DEFINE_NET_EVENT(grace_start);
575DEFINE_NET_EVENT(grace_complete);
576
Chuck Lever75acacb2021-12-28 14:27:56 -0500577TRACE_EVENT(nfsd_writeverf_reset,
578 TP_PROTO(
579 const struct nfsd_net *nn,
580 const struct svc_rqst *rqstp,
581 int error
582 ),
583 TP_ARGS(nn, rqstp, error),
584 TP_STRUCT__entry(
585 __field(unsigned long long, boot_time)
586 __field(u32, xid)
587 __field(int, error)
588 __array(unsigned char, verifier, NFS4_VERIFIER_SIZE)
589 ),
590 TP_fast_assign(
591 __entry->boot_time = nn->boot_time;
592 __entry->xid = be32_to_cpu(rqstp->rq_xid);
593 __entry->error = error;
594
595 /* avoid seqlock inside TP_fast_assign */
596 memcpy(__entry->verifier, nn->writeverf,
597 NFS4_VERIFIER_SIZE);
598 ),
599 TP_printk("boot_time=%16llx xid=0x%08x error=%d new verifier=0x%s",
600 __entry->boot_time, __entry->xid, __entry->error,
601 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
602 )
603);
604
Chuck Lever27787732021-05-14 15:55:29 -0400605TRACE_EVENT(nfsd_clid_cred_mismatch,
606 TP_PROTO(
607 const struct nfs4_client *clp,
608 const struct svc_rqst *rqstp
609 ),
610 TP_ARGS(clp, rqstp),
611 TP_STRUCT__entry(
612 __field(u32, cl_boot)
613 __field(u32, cl_id)
614 __field(unsigned long, cl_flavor)
615 __field(unsigned long, new_flavor)
616 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
617 ),
618 TP_fast_assign(
619 __entry->cl_boot = clp->cl_clientid.cl_boot;
620 __entry->cl_id = clp->cl_clientid.cl_id;
621 __entry->cl_flavor = clp->cl_cred.cr_flavor;
622 __entry->new_flavor = rqstp->rq_cred.cr_flavor;
623 memcpy(__entry->addr, &rqstp->rq_xprt->xpt_remote,
624 sizeof(struct sockaddr_in6));
625 ),
626 TP_printk("client %08x:%08x flavor=%s, conflict=%s from addr=%pISpc",
627 __entry->cl_boot, __entry->cl_id,
628 show_nfsd_authflavor(__entry->cl_flavor),
629 show_nfsd_authflavor(__entry->new_flavor), __entry->addr
630 )
631)
632
Chuck Lever744ea542021-05-14 15:55:36 -0400633TRACE_EVENT(nfsd_clid_verf_mismatch,
634 TP_PROTO(
635 const struct nfs4_client *clp,
636 const struct svc_rqst *rqstp,
637 const nfs4_verifier *verf
638 ),
639 TP_ARGS(clp, rqstp, verf),
640 TP_STRUCT__entry(
641 __field(u32, cl_boot)
642 __field(u32, cl_id)
643 __array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE)
644 __array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE)
645 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
646 ),
647 TP_fast_assign(
648 __entry->cl_boot = clp->cl_clientid.cl_boot;
649 __entry->cl_id = clp->cl_clientid.cl_id;
650 memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier,
651 NFS4_VERIFIER_SIZE);
652 memcpy(__entry->new_verifier, (void *)verf,
653 NFS4_VERIFIER_SIZE);
654 memcpy(__entry->addr, &rqstp->rq_xprt->xpt_remote,
655 sizeof(struct sockaddr_in6));
656 ),
657 TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc",
658 __entry->cl_boot, __entry->cl_id,
659 __print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE),
660 __print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE),
661 __entry->addr
662 )
663);
664
Chuck Lever237f91c2021-05-14 15:56:13 -0400665DECLARE_EVENT_CLASS(nfsd_clid_class,
666 TP_PROTO(const struct nfs4_client *clp),
667 TP_ARGS(clp),
668 TP_STRUCT__entry(
669 __field(u32, cl_boot)
670 __field(u32, cl_id)
671 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
672 __field(unsigned long, flavor)
673 __array(unsigned char, verifier, NFS4_VERIFIER_SIZE)
Chuck Leverd27b74a2021-05-14 15:34:57 -0400674 __string_len(name, name, clp->cl_name.len)
Chuck Lever237f91c2021-05-14 15:56:13 -0400675 ),
676 TP_fast_assign(
677 __entry->cl_boot = clp->cl_clientid.cl_boot;
678 __entry->cl_id = clp->cl_clientid.cl_id;
679 memcpy(__entry->addr, &clp->cl_addr,
680 sizeof(struct sockaddr_in6));
681 __entry->flavor = clp->cl_cred.cr_flavor;
682 memcpy(__entry->verifier, (void *)&clp->cl_verifier,
683 NFS4_VERIFIER_SIZE);
Chuck Leverd27b74a2021-05-14 15:34:57 -0400684 __assign_str_len(name, clp->cl_name.data, clp->cl_name.len);
Chuck Lever237f91c2021-05-14 15:56:13 -0400685 ),
686 TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x",
687 __entry->addr, __get_str(name),
688 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE),
689 show_nfsd_authflavor(__entry->flavor),
690 __entry->cl_boot, __entry->cl_id)
691);
692
693#define DEFINE_CLID_EVENT(name) \
694DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \
695 TP_PROTO(const struct nfs4_client *clp), \
696 TP_ARGS(clp))
697
698DEFINE_CLID_EVENT(fresh);
Chuck Levere8f80c52021-05-14 15:56:19 -0400699DEFINE_CLID_EVENT(confirmed_r);
Chuck Lever237f91c2021-05-14 15:56:13 -0400700
Chuck Leverb76278a2020-08-19 12:56:40 -0400701/*
702 * from fs/nfsd/filecache.h
703 */
Trond Myklebustc1928552020-01-14 12:00:22 -0500704TRACE_DEFINE_ENUM(NFSD_FILE_HASHED);
705TRACE_DEFINE_ENUM(NFSD_FILE_PENDING);
706TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ);
707TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE);
708TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED);
709
Jeff Layton65294c12019-08-18 14:18:48 -0400710#define show_nf_flags(val) \
711 __print_flags(val, "|", \
712 { 1 << NFSD_FILE_HASHED, "HASHED" }, \
713 { 1 << NFSD_FILE_PENDING, "PENDING" }, \
714 { 1 << NFSD_FILE_BREAK_READ, "BREAK_READ" }, \
715 { 1 << NFSD_FILE_BREAK_WRITE, "BREAK_WRITE" }, \
716 { 1 << NFSD_FILE_REFERENCED, "REFERENCED"})
717
Jeff Layton65294c12019-08-18 14:18:48 -0400718DECLARE_EVENT_CLASS(nfsd_file_class,
719 TP_PROTO(struct nfsd_file *nf),
720 TP_ARGS(nf),
721 TP_STRUCT__entry(
722 __field(unsigned int, nf_hashval)
723 __field(void *, nf_inode)
724 __field(int, nf_ref)
725 __field(unsigned long, nf_flags)
726 __field(unsigned char, nf_may)
727 __field(struct file *, nf_file)
728 ),
729 TP_fast_assign(
730 __entry->nf_hashval = nf->nf_hashval;
731 __entry->nf_inode = nf->nf_inode;
Trond Myklebust689827c2020-01-14 12:02:44 -0500732 __entry->nf_ref = refcount_read(&nf->nf_ref);
Jeff Layton65294c12019-08-18 14:18:48 -0400733 __entry->nf_flags = nf->nf_flags;
734 __entry->nf_may = nf->nf_may;
735 __entry->nf_file = nf->nf_file;
736 ),
Chuck Lever3a90e1d2020-09-04 15:06:26 -0400737 TP_printk("hash=0x%x inode=%p ref=%d flags=%s may=%s file=%p",
Jeff Layton65294c12019-08-18 14:18:48 -0400738 __entry->nf_hashval,
739 __entry->nf_inode,
740 __entry->nf_ref,
741 show_nf_flags(__entry->nf_flags),
Chuck Leverb76278a2020-08-19 12:56:40 -0400742 show_nfsd_may_flags(__entry->nf_may),
Jeff Layton65294c12019-08-18 14:18:48 -0400743 __entry->nf_file)
744)
745
746#define DEFINE_NFSD_FILE_EVENT(name) \
747DEFINE_EVENT(nfsd_file_class, name, \
748 TP_PROTO(struct nfsd_file *nf), \
749 TP_ARGS(nf))
750
751DEFINE_NFSD_FILE_EVENT(nfsd_file_alloc);
752DEFINE_NFSD_FILE_EVENT(nfsd_file_put_final);
753DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash);
754DEFINE_NFSD_FILE_EVENT(nfsd_file_put);
755DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_release_locked);
756
757TRACE_EVENT(nfsd_file_acquire,
758 TP_PROTO(struct svc_rqst *rqstp, unsigned int hash,
759 struct inode *inode, unsigned int may_flags,
760 struct nfsd_file *nf, __be32 status),
761
762 TP_ARGS(rqstp, hash, inode, may_flags, nf, status),
763
764 TP_STRUCT__entry(
Trond Myklebusta9ceb0602020-01-14 12:00:21 -0500765 __field(u32, xid)
Jeff Layton65294c12019-08-18 14:18:48 -0400766 __field(unsigned int, hash)
767 __field(void *, inode)
Chuck Leverb76278a2020-08-19 12:56:40 -0400768 __field(unsigned long, may_flags)
Jeff Layton65294c12019-08-18 14:18:48 -0400769 __field(int, nf_ref)
770 __field(unsigned long, nf_flags)
Chuck Leverb76278a2020-08-19 12:56:40 -0400771 __field(unsigned long, nf_may)
Jeff Layton65294c12019-08-18 14:18:48 -0400772 __field(struct file *, nf_file)
Trond Myklebusta9ceb0602020-01-14 12:00:21 -0500773 __field(u32, status)
Jeff Layton65294c12019-08-18 14:18:48 -0400774 ),
775
776 TP_fast_assign(
Trond Myklebusta9ceb0602020-01-14 12:00:21 -0500777 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Jeff Layton65294c12019-08-18 14:18:48 -0400778 __entry->hash = hash;
779 __entry->inode = inode;
780 __entry->may_flags = may_flags;
Trond Myklebust689827c2020-01-14 12:02:44 -0500781 __entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0;
Jeff Layton65294c12019-08-18 14:18:48 -0400782 __entry->nf_flags = nf ? nf->nf_flags : 0;
783 __entry->nf_may = nf ? nf->nf_may : 0;
784 __entry->nf_file = nf ? nf->nf_file : NULL;
Trond Myklebusta9ceb0602020-01-14 12:00:21 -0500785 __entry->status = be32_to_cpu(status);
Jeff Layton65294c12019-08-18 14:18:48 -0400786 ),
787
Chuck Lever3a90e1d2020-09-04 15:06:26 -0400788 TP_printk("xid=0x%x hash=0x%x inode=%p may_flags=%s ref=%d nf_flags=%s nf_may=%s nf_file=%p status=%u",
Trond Myklebusta9ceb0602020-01-14 12:00:21 -0500789 __entry->xid, __entry->hash, __entry->inode,
Chuck Leverb76278a2020-08-19 12:56:40 -0400790 show_nfsd_may_flags(__entry->may_flags),
791 __entry->nf_ref, show_nf_flags(__entry->nf_flags),
792 show_nfsd_may_flags(__entry->nf_may),
793 __entry->nf_file, __entry->status)
Jeff Layton65294c12019-08-18 14:18:48 -0400794);
795
796DECLARE_EVENT_CLASS(nfsd_file_search_class,
797 TP_PROTO(struct inode *inode, unsigned int hash, int found),
798 TP_ARGS(inode, hash, found),
799 TP_STRUCT__entry(
800 __field(struct inode *, inode)
801 __field(unsigned int, hash)
802 __field(int, found)
803 ),
804 TP_fast_assign(
805 __entry->inode = inode;
806 __entry->hash = hash;
807 __entry->found = found;
808 ),
Chuck Lever3a90e1d2020-09-04 15:06:26 -0400809 TP_printk("hash=0x%x inode=%p found=%d", __entry->hash,
Jeff Layton65294c12019-08-18 14:18:48 -0400810 __entry->inode, __entry->found)
811);
812
813#define DEFINE_NFSD_FILE_SEARCH_EVENT(name) \
814DEFINE_EVENT(nfsd_file_search_class, name, \
815 TP_PROTO(struct inode *inode, unsigned int hash, int found), \
816 TP_ARGS(inode, hash, found))
817
818DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync);
819DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode);
820DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_is_cached);
821
822TRACE_EVENT(nfsd_file_fsnotify_handle_event,
823 TP_PROTO(struct inode *inode, u32 mask),
824 TP_ARGS(inode, mask),
825 TP_STRUCT__entry(
826 __field(struct inode *, inode)
827 __field(unsigned int, nlink)
828 __field(umode_t, mode)
829 __field(u32, mask)
830 ),
831 TP_fast_assign(
832 __entry->inode = inode;
833 __entry->nlink = inode->i_nlink;
834 __entry->mode = inode->i_mode;
835 __entry->mask = mask;
836 ),
Chuck Lever3a90e1d2020-09-04 15:06:26 -0400837 TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode,
Jeff Layton65294c12019-08-18 14:18:48 -0400838 __entry->nlink, __entry->mode, __entry->mask)
839);
840
Chuck Lever0b175b12020-05-02 11:34:40 -0400841#include "cache.h"
842
843TRACE_DEFINE_ENUM(RC_DROPIT);
844TRACE_DEFINE_ENUM(RC_REPLY);
845TRACE_DEFINE_ENUM(RC_DOIT);
846
847#define show_drc_retval(x) \
848 __print_symbolic(x, \
849 { RC_DROPIT, "DROPIT" }, \
850 { RC_REPLY, "REPLY" }, \
851 { RC_DOIT, "DOIT" })
852
853TRACE_EVENT(nfsd_drc_found,
854 TP_PROTO(
855 const struct nfsd_net *nn,
856 const struct svc_rqst *rqstp,
857 int result
858 ),
859 TP_ARGS(nn, rqstp, result),
860 TP_STRUCT__entry(
861 __field(unsigned long long, boot_time)
862 __field(unsigned long, result)
863 __field(u32, xid)
864 ),
865 TP_fast_assign(
866 __entry->boot_time = nn->boot_time;
867 __entry->result = result;
868 __entry->xid = be32_to_cpu(rqstp->rq_xid);
869 ),
870 TP_printk("boot_time=%16llx xid=0x%08x result=%s",
871 __entry->boot_time, __entry->xid,
872 show_drc_retval(__entry->result))
873
874);
875
876TRACE_EVENT(nfsd_drc_mismatch,
877 TP_PROTO(
878 const struct nfsd_net *nn,
879 const struct svc_cacherep *key,
880 const struct svc_cacherep *rp
881 ),
882 TP_ARGS(nn, key, rp),
883 TP_STRUCT__entry(
884 __field(unsigned long long, boot_time)
885 __field(u32, xid)
886 __field(u32, cached)
887 __field(u32, ingress)
888 ),
889 TP_fast_assign(
890 __entry->boot_time = nn->boot_time;
891 __entry->xid = be32_to_cpu(key->c_key.k_xid);
892 __entry->cached = (__force u32)key->c_key.k_csum;
893 __entry->ingress = (__force u32)rp->c_key.k_csum;
894 ),
895 TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x",
896 __entry->boot_time, __entry->xid, __entry->cached,
897 __entry->ingress)
898);
899
Chuck Lever1eace0d2020-04-05 14:15:29 -0400900TRACE_EVENT(nfsd_cb_args,
901 TP_PROTO(
902 const struct nfs4_client *clp,
903 const struct nfs4_cb_conn *conn
904 ),
905 TP_ARGS(clp, conn),
906 TP_STRUCT__entry(
907 __field(u32, cl_boot)
908 __field(u32, cl_id)
909 __field(u32, prog)
910 __field(u32, ident)
911 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
912 ),
913 TP_fast_assign(
914 __entry->cl_boot = clp->cl_clientid.cl_boot;
915 __entry->cl_id = clp->cl_clientid.cl_id;
916 __entry->prog = conn->cb_prog;
917 __entry->ident = conn->cb_ident;
918 memcpy(__entry->addr, &conn->cb_addr,
919 sizeof(struct sockaddr_in6));
920 ),
Chuck Leverd6cbe982021-05-14 15:57:39 -0400921 TP_printk("addr=%pISpc client %08x:%08x prog=%u ident=%u",
922 __entry->addr, __entry->cl_boot, __entry->cl_id,
923 __entry->prog, __entry->ident)
Chuck Lever1eace0d2020-04-05 14:15:29 -0400924);
925
926TRACE_EVENT(nfsd_cb_nodelegs,
927 TP_PROTO(const struct nfs4_client *clp),
928 TP_ARGS(clp),
929 TP_STRUCT__entry(
930 __field(u32, cl_boot)
931 __field(u32, cl_id)
932 ),
933 TP_fast_assign(
934 __entry->cl_boot = clp->cl_clientid.cl_boot;
935 __entry->cl_id = clp->cl_clientid.cl_id;
936 ),
937 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
938)
939
Chuck Lever1eace0d2020-04-05 14:15:29 -0400940#define show_cb_state(val) \
941 __print_symbolic(val, \
942 { NFSD4_CB_UP, "UP" }, \
943 { NFSD4_CB_UNKNOWN, "UNKNOWN" }, \
944 { NFSD4_CB_DOWN, "DOWN" }, \
945 { NFSD4_CB_FAULT, "FAULT"})
946
947DECLARE_EVENT_CLASS(nfsd_cb_class,
948 TP_PROTO(const struct nfs4_client *clp),
949 TP_ARGS(clp),
950 TP_STRUCT__entry(
951 __field(unsigned long, state)
952 __field(u32, cl_boot)
953 __field(u32, cl_id)
954 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
955 ),
956 TP_fast_assign(
957 __entry->state = clp->cl_cb_state;
958 __entry->cl_boot = clp->cl_clientid.cl_boot;
959 __entry->cl_id = clp->cl_clientid.cl_id;
960 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
961 sizeof(struct sockaddr_in6));
962 ),
963 TP_printk("addr=%pISpc client %08x:%08x state=%s",
964 __entry->addr, __entry->cl_boot, __entry->cl_id,
965 show_cb_state(__entry->state))
966);
967
968#define DEFINE_NFSD_CB_EVENT(name) \
969DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name, \
970 TP_PROTO(const struct nfs4_client *clp), \
971 TP_ARGS(clp))
972
Chuck Lever1eace0d2020-04-05 14:15:29 -0400973DEFINE_NFSD_CB_EVENT(state);
Chuck Lever4ade8922021-05-14 15:57:26 -0400974DEFINE_NFSD_CB_EVENT(probe);
Chuck Lever806d65b2021-05-14 15:56:43 -0400975DEFINE_NFSD_CB_EVENT(lost);
Chuck Lever1eace0d2020-04-05 14:15:29 -0400976DEFINE_NFSD_CB_EVENT(shutdown);
977
Chuck Lever87b23942021-05-14 15:55:23 -0400978TRACE_DEFINE_ENUM(RPC_AUTH_NULL);
979TRACE_DEFINE_ENUM(RPC_AUTH_UNIX);
980TRACE_DEFINE_ENUM(RPC_AUTH_GSS);
981TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5);
982TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I);
983TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P);
984
985#define show_nfsd_authflavor(val) \
986 __print_symbolic(val, \
987 { RPC_AUTH_NULL, "none" }, \
988 { RPC_AUTH_UNIX, "sys" }, \
989 { RPC_AUTH_GSS, "gss" }, \
990 { RPC_AUTH_GSS_KRB5, "krb5" }, \
991 { RPC_AUTH_GSS_KRB5I, "krb5i" }, \
992 { RPC_AUTH_GSS_KRB5P, "krb5p" })
993
Chuck Lever3c92fba2021-05-14 15:57:02 -0400994TRACE_EVENT(nfsd_cb_setup,
995 TP_PROTO(const struct nfs4_client *clp,
996 const char *netid,
997 rpc_authflavor_t authflavor
998 ),
999 TP_ARGS(clp, netid, authflavor),
1000 TP_STRUCT__entry(
1001 __field(u32, cl_boot)
1002 __field(u32, cl_id)
1003 __field(unsigned long, authflavor)
1004 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
1005 __array(unsigned char, netid, 8)
1006 ),
1007 TP_fast_assign(
1008 __entry->cl_boot = clp->cl_clientid.cl_boot;
1009 __entry->cl_id = clp->cl_clientid.cl_id;
1010 strlcpy(__entry->netid, netid, sizeof(__entry->netid));
1011 __entry->authflavor = authflavor;
1012 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
1013 sizeof(struct sockaddr_in6));
1014 ),
1015 TP_printk("addr=%pISpc client %08x:%08x proto=%s flavor=%s",
1016 __entry->addr, __entry->cl_boot, __entry->cl_id,
1017 __entry->netid, show_nfsd_authflavor(__entry->authflavor))
1018);
1019
Chuck Lever1eace0d2020-04-05 14:15:29 -04001020TRACE_EVENT(nfsd_cb_setup_err,
1021 TP_PROTO(
1022 const struct nfs4_client *clp,
1023 long error
1024 ),
1025 TP_ARGS(clp, error),
1026 TP_STRUCT__entry(
1027 __field(long, error)
1028 __field(u32, cl_boot)
1029 __field(u32, cl_id)
1030 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
1031 ),
1032 TP_fast_assign(
1033 __entry->error = error;
1034 __entry->cl_boot = clp->cl_clientid.cl_boot;
1035 __entry->cl_id = clp->cl_clientid.cl_id;
1036 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
1037 sizeof(struct sockaddr_in6));
1038 ),
1039 TP_printk("addr=%pISpc client %08x:%08x error=%ld",
1040 __entry->addr, __entry->cl_boot, __entry->cl_id, __entry->error)
1041);
1042
Chuck Lever17d76dd2021-05-14 15:57:20 -04001043TRACE_EVENT(nfsd_cb_recall,
1044 TP_PROTO(
1045 const struct nfs4_stid *stid
1046 ),
1047 TP_ARGS(stid),
1048 TP_STRUCT__entry(
1049 __field(u32, cl_boot)
1050 __field(u32, cl_id)
1051 __field(u32, si_id)
1052 __field(u32, si_generation)
1053 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
1054 ),
1055 TP_fast_assign(
1056 const stateid_t *stp = &stid->sc_stateid;
1057 const struct nfs4_client *clp = stid->sc_client;
1058
1059 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1060 __entry->cl_id = stp->si_opaque.so_clid.cl_id;
1061 __entry->si_id = stp->si_opaque.so_id;
1062 __entry->si_generation = stp->si_generation;
1063 if (clp)
1064 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
1065 sizeof(struct sockaddr_in6));
1066 else
1067 memset(__entry->addr, 0, sizeof(struct sockaddr_in6));
1068 ),
1069 TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x",
1070 __entry->addr, __entry->cl_boot, __entry->cl_id,
1071 __entry->si_id, __entry->si_generation)
1072);
1073
Chuck Lever2cde7f82021-05-14 15:57:08 -04001074TRACE_EVENT(nfsd_cb_notify_lock,
1075 TP_PROTO(
1076 const struct nfs4_lockowner *lo,
1077 const struct nfsd4_blocked_lock *nbl
1078 ),
1079 TP_ARGS(lo, nbl),
1080 TP_STRUCT__entry(
1081 __field(u32, cl_boot)
1082 __field(u32, cl_id)
1083 __field(u32, fh_hash)
1084 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
1085 ),
1086 TP_fast_assign(
1087 const struct nfs4_client *clp = lo->lo_owner.so_client;
1088
1089 __entry->cl_boot = clp->cl_clientid.cl_boot;
1090 __entry->cl_id = clp->cl_clientid.cl_id;
1091 __entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh);
1092 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
1093 sizeof(struct sockaddr_in6));
1094 ),
1095 TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x",
1096 __entry->addr, __entry->cl_boot, __entry->cl_id,
1097 __entry->fh_hash)
1098);
1099
Chuck Lever87512382021-05-14 15:57:14 -04001100TRACE_EVENT(nfsd_cb_offload,
1101 TP_PROTO(
1102 const struct nfs4_client *clp,
1103 const stateid_t *stp,
1104 const struct knfsd_fh *fh,
1105 u64 count,
1106 __be32 status
1107 ),
1108 TP_ARGS(clp, stp, fh, count, status),
1109 TP_STRUCT__entry(
1110 __field(u32, cl_boot)
1111 __field(u32, cl_id)
1112 __field(u32, si_id)
1113 __field(u32, si_generation)
1114 __field(u32, fh_hash)
1115 __field(int, status)
1116 __field(u64, count)
1117 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
1118 ),
1119 TP_fast_assign(
1120 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
1121 __entry->cl_id = stp->si_opaque.so_clid.cl_id;
1122 __entry->si_id = stp->si_opaque.so_id;
1123 __entry->si_generation = stp->si_generation;
1124 __entry->fh_hash = knfsd_fh_hash(fh);
1125 __entry->status = be32_to_cpu(status);
1126 __entry->count = count;
1127 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
1128 sizeof(struct sockaddr_in6));
1129 ),
1130 TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x fh_hash=0x%08x count=%llu status=%d",
1131 __entry->addr, __entry->cl_boot, __entry->cl_id,
1132 __entry->si_id, __entry->si_generation,
1133 __entry->fh_hash, __entry->count, __entry->status)
1134);
1135
Christoph Hellwig31ef83d2014-08-16 19:02:22 -05001136#endif /* _NFSD_TRACE_H */
1137
1138#undef TRACE_INCLUDE_PATH
1139#define TRACE_INCLUDE_PATH .
1140#define TRACE_INCLUDE_FILE trace
1141#include <trace/define_trace.h>