Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 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> |
Chuck Lever | 8791545 | 2021-10-22 16:17:03 -0400 | [diff] [blame] | 12 | |
Trond Myklebust | cf749f3 | 2020-03-01 18:21:40 -0500 | [diff] [blame] | 13 | #include "export.h" |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 14 | #include "nfsfh.h" |
| 15 | |
Chuck Lever | 0dfdad1 | 2020-10-19 13:00:29 -0400 | [diff] [blame] | 16 | #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 Lever | 0828134 | 2020-11-21 11:36:42 -0500 | [diff] [blame] | 32 | #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 Lever | 70e94d7 | 2021-10-21 12:11:45 -0400 | [diff] [blame] | 50 | DECLARE_EVENT_CLASS(nfsd_xdr_err_class, |
Chuck Lever | 0dfdad1 | 2020-10-19 13:00:29 -0400 | [diff] [blame] | 51 | 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 Lever | 70e94d7 | 2021-10-21 12:11:45 -0400 | [diff] [blame] | 72 | #define DEFINE_NFSD_XDR_ERR_EVENT(name) \ |
| 73 | DEFINE_EVENT(nfsd_xdr_err_class, nfsd_##name##_err, \ |
| 74 | TP_PROTO(const struct svc_rqst *rqstp), \ |
| 75 | TP_ARGS(rqstp)) |
Chuck Lever | 0dfdad1 | 2020-10-19 13:00:29 -0400 | [diff] [blame] | 76 | |
Chuck Lever | 70e94d7 | 2021-10-21 12:11:45 -0400 | [diff] [blame] | 77 | DEFINE_NFSD_XDR_ERR_EVENT(garbage_args); |
| 78 | DEFINE_NFSD_XDR_ERR_EVENT(cant_encode); |
Chuck Lever | 0dfdad1 | 2020-10-19 13:00:29 -0400 | [diff] [blame] | 79 | |
Chuck Lever | b76278a | 2020-08-19 12:56:40 -0400 | [diff] [blame] | 80 | #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 Lever | fff4080 | 2018-03-27 10:53:54 -0400 | [diff] [blame] | 96 | TRACE_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 | |
| 112 | TRACE_EVENT(nfsd_compound_status, |
| 113 | TP_PROTO(u32 args_opcnt, |
| 114 | u32 resp_opcnt, |
| 115 | __be32 status, |
| 116 | const char *name), |
| 117 | TP_ARGS(args_opcnt, resp_opcnt, status, name), |
| 118 | TP_STRUCT__entry( |
| 119 | __field(u32, args_opcnt) |
| 120 | __field(u32, resp_opcnt) |
| 121 | __field(int, status) |
| 122 | __string(name, name) |
| 123 | ), |
| 124 | TP_fast_assign( |
| 125 | __entry->args_opcnt = args_opcnt; |
| 126 | __entry->resp_opcnt = resp_opcnt; |
| 127 | __entry->status = be32_to_cpu(status); |
| 128 | __assign_str(name, name); |
| 129 | ), |
| 130 | TP_printk("op=%u/%u %s status=%d", |
| 131 | __entry->resp_opcnt, __entry->args_opcnt, |
| 132 | __get_str(name), __entry->status) |
| 133 | ) |
| 134 | |
Chuck Lever | 0828134 | 2020-11-21 11:36:42 -0500 | [diff] [blame] | 135 | TRACE_EVENT(nfsd_compound_decode_err, |
| 136 | TP_PROTO( |
| 137 | const struct svc_rqst *rqstp, |
| 138 | u32 args_opcnt, |
| 139 | u32 resp_opcnt, |
| 140 | u32 opnum, |
| 141 | __be32 status |
| 142 | ), |
| 143 | TP_ARGS(rqstp, args_opcnt, resp_opcnt, opnum, status), |
| 144 | TP_STRUCT__entry( |
| 145 | NFSD_TRACE_PROC_RES_FIELDS |
| 146 | |
| 147 | __field(u32, args_opcnt) |
| 148 | __field(u32, resp_opcnt) |
| 149 | __field(u32, opnum) |
| 150 | ), |
| 151 | TP_fast_assign( |
| 152 | NFSD_TRACE_PROC_RES_ASSIGNMENTS(status) |
| 153 | |
| 154 | __entry->args_opcnt = args_opcnt; |
| 155 | __entry->resp_opcnt = resp_opcnt; |
| 156 | __entry->opnum = opnum; |
| 157 | ), |
| 158 | TP_printk("op=%u/%u opnum=%u status=%lu", |
| 159 | __entry->resp_opcnt, __entry->args_opcnt, |
| 160 | __entry->opnum, __entry->status) |
| 161 | ); |
| 162 | |
| 163 | TRACE_EVENT(nfsd_compound_encode_err, |
| 164 | TP_PROTO( |
| 165 | const struct svc_rqst *rqstp, |
| 166 | u32 opnum, |
| 167 | __be32 status |
| 168 | ), |
| 169 | TP_ARGS(rqstp, opnum, status), |
| 170 | TP_STRUCT__entry( |
| 171 | NFSD_TRACE_PROC_RES_FIELDS |
| 172 | |
| 173 | __field(u32, opnum) |
| 174 | ), |
| 175 | TP_fast_assign( |
| 176 | NFSD_TRACE_PROC_RES_ASSIGNMENTS(status) |
| 177 | |
| 178 | __entry->opnum = opnum; |
| 179 | ), |
| 180 | TP_printk("opnum=%u status=%lu", |
| 181 | __entry->opnum, __entry->status) |
| 182 | ); |
| 183 | |
| 184 | |
Trond Myklebust | f01274a | 2020-03-01 18:21:39 -0500 | [diff] [blame] | 185 | DECLARE_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) \ |
| 206 | DEFINE_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 | |
| 212 | DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport); |
| 213 | DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle); |
| 214 | |
Trond Myklebust | cf749f3 | 2020-03-01 18:21:40 -0500 | [diff] [blame] | 215 | TRACE_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 Myklebust | 6a30e47 | 2020-03-01 18:21:41 -0500 | [diff] [blame] | 239 | TRACE_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 Myklebust | cf749f3 | 2020-03-01 18:21:40 -0500 | [diff] [blame] | 265 | TRACE_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 Myklebust | 6a30e47 | 2020-03-01 18:21:41 -0500 | [diff] [blame] | 286 | TRACE_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 Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 306 | DECLARE_EVENT_CLASS(nfsd_io_class, |
| 307 | TP_PROTO(struct svc_rqst *rqstp, |
| 308 | struct svc_fh *fhp, |
Chuck Lever | 6a4d333 | 2022-02-04 17:05:24 -0500 | [diff] [blame] | 309 | u64 offset, |
| 310 | u32 len), |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 311 | TP_ARGS(rqstp, fhp, offset, len), |
| 312 | TP_STRUCT__entry( |
Chuck Lever | afa720a | 2018-03-27 10:52:43 -0400 | [diff] [blame] | 313 | __field(u32, xid) |
| 314 | __field(u32, fh_hash) |
Chuck Lever | 6a4d333 | 2022-02-04 17:05:24 -0500 | [diff] [blame] | 315 | __field(u64, offset) |
| 316 | __field(u32, len) |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 317 | ), |
| 318 | TP_fast_assign( |
Chuck Lever | afa720a | 2018-03-27 10:52:43 -0400 | [diff] [blame] | 319 | __entry->xid = be32_to_cpu(rqstp->rq_xid); |
Chuck Lever | 79e0b4e | 2018-03-27 10:52:57 -0400 | [diff] [blame] | 320 | __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 321 | __entry->offset = offset; |
| 322 | __entry->len = len; |
| 323 | ), |
Chuck Lever | 6a4d333 | 2022-02-04 17:05:24 -0500 | [diff] [blame] | 324 | TP_printk("xid=0x%08x fh_hash=0x%08x offset=%llu len=%u", |
Chuck Lever | afa720a | 2018-03-27 10:52:43 -0400 | [diff] [blame] | 325 | __entry->xid, __entry->fh_hash, |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 326 | __entry->offset, __entry->len) |
| 327 | ) |
| 328 | |
| 329 | #define DEFINE_NFSD_IO_EVENT(name) \ |
Chuck Lever | f394b62 | 2018-03-27 10:53:11 -0400 | [diff] [blame] | 330 | DEFINE_EVENT(nfsd_io_class, nfsd_##name, \ |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 331 | TP_PROTO(struct svc_rqst *rqstp, \ |
| 332 | struct svc_fh *fhp, \ |
Chuck Lever | 6a4d333 | 2022-02-04 17:05:24 -0500 | [diff] [blame] | 333 | u64 offset, \ |
| 334 | u32 len), \ |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 335 | TP_ARGS(rqstp, fhp, offset, len)) |
| 336 | |
| 337 | DEFINE_NFSD_IO_EVENT(read_start); |
Chuck Lever | 87c5942 | 2018-03-28 13:29:11 -0400 | [diff] [blame] | 338 | DEFINE_NFSD_IO_EVENT(read_splice); |
| 339 | DEFINE_NFSD_IO_EVENT(read_vector); |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 340 | DEFINE_NFSD_IO_EVENT(read_io_done); |
| 341 | DEFINE_NFSD_IO_EVENT(read_done); |
| 342 | DEFINE_NFSD_IO_EVENT(write_start); |
| 343 | DEFINE_NFSD_IO_EVENT(write_opened); |
| 344 | DEFINE_NFSD_IO_EVENT(write_io_done); |
| 345 | DEFINE_NFSD_IO_EVENT(write_done); |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 346 | |
Chuck Lever | d890be1 | 2018-03-27 10:53:27 -0400 | [diff] [blame] | 347 | DECLARE_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) \ |
| 371 | DEFINE_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 Lever | 87c5942 | 2018-03-28 13:29:11 -0400 | [diff] [blame] | 378 | DEFINE_NFSD_ERR_EVENT(read_err); |
Chuck Lever | d890be1 | 2018-03-27 10:53:27 -0400 | [diff] [blame] | 379 | DEFINE_NFSD_ERR_EVENT(write_err); |
| 380 | |
Chuck Lever | 6019ce07 | 2021-03-05 13:57:40 -0500 | [diff] [blame] | 381 | TRACE_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 Lever | 408c0de | 2021-05-12 09:39:06 -0400 | [diff] [blame] | 390 | __string_len(name, name, namlen) |
Chuck Lever | 6019ce07 | 2021-03-05 13:57:40 -0500 | [diff] [blame] | 391 | ), |
| 392 | TP_fast_assign( |
| 393 | __entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0; |
| 394 | __entry->ino = ino; |
Chuck Lever | 408c0de | 2021-05-12 09:39:06 -0400 | [diff] [blame] | 395 | __assign_str_len(name, name, namlen) |
Chuck Lever | 6019ce07 | 2021-03-05 13:57:40 -0500 | [diff] [blame] | 396 | ), |
Chuck Lever | 408c0de | 2021-05-12 09:39:06 -0400 | [diff] [blame] | 397 | TP_printk("fh_hash=0x%08x ino=%llu name=%s", |
| 398 | __entry->fh_hash, __entry->ino, __get_str(name) |
| 399 | ) |
Chuck Lever | 6019ce07 | 2021-03-05 13:57:40 -0500 | [diff] [blame] | 400 | ) |
| 401 | |
Trond Myklebust | a2f4c3f | 2021-12-18 20:38:00 -0500 | [diff] [blame] | 402 | DECLARE_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) \ |
| 439 | DEFINE_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 | |
| 450 | DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err); |
| 451 | |
Jeff Layton | 825213e | 2015-10-03 08:19:57 -0400 | [diff] [blame] | 452 | #include "state.h" |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 453 | #include "filecache.h" |
| 454 | #include "vfs.h" |
Jeff Layton | 825213e | 2015-10-03 08:19:57 -0400 | [diff] [blame] | 455 | |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 456 | DECLARE_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 Lever | f394b62 | 2018-03-27 10:53:11 -0400 | [diff] [blame] | 479 | DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \ |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 480 | TP_PROTO(stateid_t *stp), \ |
| 481 | TP_ARGS(stp)) |
Chuck Lever | dd5e3fb | 2020-04-05 11:42:29 -0400 | [diff] [blame] | 482 | |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 483 | DEFINE_STATEID_EVENT(layoutstate_alloc); |
| 484 | DEFINE_STATEID_EVENT(layoutstate_unhash); |
| 485 | DEFINE_STATEID_EVENT(layoutstate_free); |
| 486 | DEFINE_STATEID_EVENT(layout_get_lookup_fail); |
| 487 | DEFINE_STATEID_EVENT(layout_commit_lookup_fail); |
| 488 | DEFINE_STATEID_EVENT(layout_return_lookup_fail); |
| 489 | DEFINE_STATEID_EVENT(layout_recall); |
| 490 | DEFINE_STATEID_EVENT(layout_recall_done); |
| 491 | DEFINE_STATEID_EVENT(layout_recall_fail); |
| 492 | DEFINE_STATEID_EVENT(layout_recall_release); |
| 493 | |
Hou Tao | 3caf917 | 2020-08-28 15:02:55 +0800 | [diff] [blame] | 494 | DEFINE_STATEID_EVENT(open); |
| 495 | DEFINE_STATEID_EVENT(deleg_read); |
Chuck Lever | dd5e3fb | 2020-04-05 11:42:29 -0400 | [diff] [blame] | 496 | DEFINE_STATEID_EVENT(deleg_recall); |
| 497 | |
| 498 | DECLARE_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) \ |
| 521 | DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \ |
| 522 | TP_PROTO(u32 seqid, const stateid_t *stp), \ |
| 523 | TP_ARGS(seqid, stp)) |
| 524 | |
| 525 | DEFINE_STATESEQID_EVENT(preprocess); |
| 526 | DEFINE_STATESEQID_EVENT(open_confirm); |
| 527 | |
| 528 | DECLARE_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) \ |
| 543 | DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \ |
| 544 | TP_PROTO(const clientid_t *clid), \ |
| 545 | TP_ARGS(clid)) |
| 546 | |
Chuck Lever | 237f91c | 2021-05-14 15:56:13 -0400 | [diff] [blame] | 547 | DEFINE_CLIENTID_EVENT(expire_unconf); |
Chuck Lever | cee8aa0 | 2021-05-14 15:55:54 -0400 | [diff] [blame] | 548 | DEFINE_CLIENTID_EVENT(reclaim_complete); |
Chuck Lever | 7e3b32a | 2021-05-14 15:55:48 -0400 | [diff] [blame] | 549 | DEFINE_CLIENTID_EVENT(confirmed); |
Chuck Lever | c41a9b7 | 2021-05-14 15:56:00 -0400 | [diff] [blame] | 550 | DEFINE_CLIENTID_EVENT(destroyed); |
Chuck Lever | 2958d2e | 2021-05-14 15:56:06 -0400 | [diff] [blame] | 551 | DEFINE_CLIENTID_EVENT(admin_expired); |
| 552 | DEFINE_CLIENTID_EVENT(replaced); |
Chuck Lever | dd5e3fb | 2020-04-05 11:42:29 -0400 | [diff] [blame] | 553 | DEFINE_CLIENTID_EVENT(purged); |
| 554 | DEFINE_CLIENTID_EVENT(renew); |
| 555 | DEFINE_CLIENTID_EVENT(stale); |
| 556 | |
| 557 | DECLARE_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) \ |
| 570 | DEFINE_EVENT(nfsd_net_class, nfsd_##name, \ |
| 571 | TP_PROTO(const struct nfsd_net *nn), \ |
| 572 | TP_ARGS(nn)) |
| 573 | |
| 574 | DEFINE_NET_EVENT(grace_start); |
| 575 | DEFINE_NET_EVENT(grace_complete); |
| 576 | |
Chuck Lever | 75acacb | 2021-12-28 14:27:56 -0500 | [diff] [blame] | 577 | TRACE_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 Lever | 2778773 | 2021-05-14 15:55:29 -0400 | [diff] [blame] | 605 | TRACE_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 Lever | 744ea54 | 2021-05-14 15:55:36 -0400 | [diff] [blame] | 633 | TRACE_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 Lever | 237f91c | 2021-05-14 15:56:13 -0400 | [diff] [blame] | 665 | DECLARE_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 Lever | d27b74a | 2021-05-14 15:34:57 -0400 | [diff] [blame] | 674 | __string_len(name, name, clp->cl_name.len) |
Chuck Lever | 237f91c | 2021-05-14 15:56:13 -0400 | [diff] [blame] | 675 | ), |
| 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 Lever | d27b74a | 2021-05-14 15:34:57 -0400 | [diff] [blame] | 684 | __assign_str_len(name, clp->cl_name.data, clp->cl_name.len); |
Chuck Lever | 237f91c | 2021-05-14 15:56:13 -0400 | [diff] [blame] | 685 | ), |
| 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) \ |
| 694 | DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \ |
| 695 | TP_PROTO(const struct nfs4_client *clp), \ |
| 696 | TP_ARGS(clp)) |
| 697 | |
| 698 | DEFINE_CLID_EVENT(fresh); |
Chuck Lever | e8f80c5 | 2021-05-14 15:56:19 -0400 | [diff] [blame] | 699 | DEFINE_CLID_EVENT(confirmed_r); |
Chuck Lever | 237f91c | 2021-05-14 15:56:13 -0400 | [diff] [blame] | 700 | |
Chuck Lever | b76278a | 2020-08-19 12:56:40 -0400 | [diff] [blame] | 701 | /* |
| 702 | * from fs/nfsd/filecache.h |
| 703 | */ |
Trond Myklebust | c192855 | 2020-01-14 12:00:22 -0500 | [diff] [blame] | 704 | TRACE_DEFINE_ENUM(NFSD_FILE_HASHED); |
| 705 | TRACE_DEFINE_ENUM(NFSD_FILE_PENDING); |
| 706 | TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ); |
| 707 | TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE); |
| 708 | TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED); |
| 709 | |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 710 | #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 Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 718 | DECLARE_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 Myklebust | 689827c | 2020-01-14 12:02:44 -0500 | [diff] [blame] | 732 | __entry->nf_ref = refcount_read(&nf->nf_ref); |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 733 | __entry->nf_flags = nf->nf_flags; |
| 734 | __entry->nf_may = nf->nf_may; |
| 735 | __entry->nf_file = nf->nf_file; |
| 736 | ), |
Chuck Lever | 3a90e1d | 2020-09-04 15:06:26 -0400 | [diff] [blame] | 737 | TP_printk("hash=0x%x inode=%p ref=%d flags=%s may=%s file=%p", |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 738 | __entry->nf_hashval, |
| 739 | __entry->nf_inode, |
| 740 | __entry->nf_ref, |
| 741 | show_nf_flags(__entry->nf_flags), |
Chuck Lever | b76278a | 2020-08-19 12:56:40 -0400 | [diff] [blame] | 742 | show_nfsd_may_flags(__entry->nf_may), |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 743 | __entry->nf_file) |
| 744 | ) |
| 745 | |
| 746 | #define DEFINE_NFSD_FILE_EVENT(name) \ |
| 747 | DEFINE_EVENT(nfsd_file_class, name, \ |
| 748 | TP_PROTO(struct nfsd_file *nf), \ |
| 749 | TP_ARGS(nf)) |
| 750 | |
| 751 | DEFINE_NFSD_FILE_EVENT(nfsd_file_alloc); |
| 752 | DEFINE_NFSD_FILE_EVENT(nfsd_file_put_final); |
| 753 | DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash); |
| 754 | DEFINE_NFSD_FILE_EVENT(nfsd_file_put); |
| 755 | DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_release_locked); |
| 756 | |
| 757 | TRACE_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 Myklebust | a9ceb060 | 2020-01-14 12:00:21 -0500 | [diff] [blame] | 765 | __field(u32, xid) |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 766 | __field(unsigned int, hash) |
| 767 | __field(void *, inode) |
Chuck Lever | b76278a | 2020-08-19 12:56:40 -0400 | [diff] [blame] | 768 | __field(unsigned long, may_flags) |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 769 | __field(int, nf_ref) |
| 770 | __field(unsigned long, nf_flags) |
Chuck Lever | b76278a | 2020-08-19 12:56:40 -0400 | [diff] [blame] | 771 | __field(unsigned long, nf_may) |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 772 | __field(struct file *, nf_file) |
Trond Myklebust | a9ceb060 | 2020-01-14 12:00:21 -0500 | [diff] [blame] | 773 | __field(u32, status) |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 774 | ), |
| 775 | |
| 776 | TP_fast_assign( |
Trond Myklebust | a9ceb060 | 2020-01-14 12:00:21 -0500 | [diff] [blame] | 777 | __entry->xid = be32_to_cpu(rqstp->rq_xid); |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 778 | __entry->hash = hash; |
| 779 | __entry->inode = inode; |
| 780 | __entry->may_flags = may_flags; |
Trond Myklebust | 689827c | 2020-01-14 12:02:44 -0500 | [diff] [blame] | 781 | __entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0; |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 782 | __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 Myklebust | a9ceb060 | 2020-01-14 12:00:21 -0500 | [diff] [blame] | 785 | __entry->status = be32_to_cpu(status); |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 786 | ), |
| 787 | |
Chuck Lever | 3a90e1d | 2020-09-04 15:06:26 -0400 | [diff] [blame] | 788 | 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 Myklebust | a9ceb060 | 2020-01-14 12:00:21 -0500 | [diff] [blame] | 789 | __entry->xid, __entry->hash, __entry->inode, |
Chuck Lever | b76278a | 2020-08-19 12:56:40 -0400 | [diff] [blame] | 790 | 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 Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 794 | ); |
| 795 | |
| 796 | DECLARE_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 Lever | 3a90e1d | 2020-09-04 15:06:26 -0400 | [diff] [blame] | 809 | TP_printk("hash=0x%x inode=%p found=%d", __entry->hash, |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 810 | __entry->inode, __entry->found) |
| 811 | ); |
| 812 | |
| 813 | #define DEFINE_NFSD_FILE_SEARCH_EVENT(name) \ |
| 814 | DEFINE_EVENT(nfsd_file_search_class, name, \ |
| 815 | TP_PROTO(struct inode *inode, unsigned int hash, int found), \ |
| 816 | TP_ARGS(inode, hash, found)) |
| 817 | |
| 818 | DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync); |
| 819 | DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode); |
| 820 | DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_is_cached); |
| 821 | |
| 822 | TRACE_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 Lever | 3a90e1d | 2020-09-04 15:06:26 -0400 | [diff] [blame] | 837 | TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode, |
Jeff Layton | 65294c1 | 2019-08-18 14:18:48 -0400 | [diff] [blame] | 838 | __entry->nlink, __entry->mode, __entry->mask) |
| 839 | ); |
| 840 | |
Chuck Lever | 0b175b1 | 2020-05-02 11:34:40 -0400 | [diff] [blame] | 841 | #include "cache.h" |
| 842 | |
| 843 | TRACE_DEFINE_ENUM(RC_DROPIT); |
| 844 | TRACE_DEFINE_ENUM(RC_REPLY); |
| 845 | TRACE_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 | |
| 853 | TRACE_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 | |
| 876 | TRACE_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 Lever | 1eace0d | 2020-04-05 14:15:29 -0400 | [diff] [blame] | 900 | TRACE_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 Lever | d6cbe98 | 2021-05-14 15:57:39 -0400 | [diff] [blame] | 921 | 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 Lever | 1eace0d | 2020-04-05 14:15:29 -0400 | [diff] [blame] | 924 | ); |
| 925 | |
| 926 | TRACE_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 Lever | 1eace0d | 2020-04-05 14:15:29 -0400 | [diff] [blame] | 940 | #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 | |
| 947 | DECLARE_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) \ |
| 969 | DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name, \ |
| 970 | TP_PROTO(const struct nfs4_client *clp), \ |
| 971 | TP_ARGS(clp)) |
| 972 | |
Chuck Lever | 1eace0d | 2020-04-05 14:15:29 -0400 | [diff] [blame] | 973 | DEFINE_NFSD_CB_EVENT(state); |
Chuck Lever | 4ade892 | 2021-05-14 15:57:26 -0400 | [diff] [blame] | 974 | DEFINE_NFSD_CB_EVENT(probe); |
Chuck Lever | 806d65b | 2021-05-14 15:56:43 -0400 | [diff] [blame] | 975 | DEFINE_NFSD_CB_EVENT(lost); |
Chuck Lever | 1eace0d | 2020-04-05 14:15:29 -0400 | [diff] [blame] | 976 | DEFINE_NFSD_CB_EVENT(shutdown); |
| 977 | |
Chuck Lever | 87b2394 | 2021-05-14 15:55:23 -0400 | [diff] [blame] | 978 | TRACE_DEFINE_ENUM(RPC_AUTH_NULL); |
| 979 | TRACE_DEFINE_ENUM(RPC_AUTH_UNIX); |
| 980 | TRACE_DEFINE_ENUM(RPC_AUTH_GSS); |
| 981 | TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); |
| 982 | TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); |
| 983 | TRACE_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 Lever | 3c92fba | 2021-05-14 15:57:02 -0400 | [diff] [blame] | 994 | TRACE_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 Lever | 1eace0d | 2020-04-05 14:15:29 -0400 | [diff] [blame] | 1020 | TRACE_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 Lever | 17d76dd | 2021-05-14 15:57:20 -0400 | [diff] [blame] | 1043 | TRACE_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 Lever | 2cde7f8 | 2021-05-14 15:57:08 -0400 | [diff] [blame] | 1074 | TRACE_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 Lever | 8751238 | 2021-05-14 15:57:14 -0400 | [diff] [blame] | 1100 | TRACE_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 Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 1136 | #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> |