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 "export.h" 13 #include "nfsfh.h" 14 15 #define NFSD_TRACE_PROC_ARG_FIELDS \ 16 __field(unsigned int, netns_ino) \ 17 __field(u32, xid) \ 18 __array(unsigned char, server, sizeof(struct sockaddr_in6)) \ 19 __array(unsigned char, client, sizeof(struct sockaddr_in6)) 20 21 #define NFSD_TRACE_PROC_ARG_ASSIGNMENTS \ 22 do { \ 23 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; \ 24 __entry->xid = be32_to_cpu(rqstp->rq_xid); \ 25 memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \ 26 rqstp->rq_xprt->xpt_locallen); \ 27 memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \ 28 rqstp->rq_xprt->xpt_remotelen); \ 29 } while (0); 30 31 #define NFSD_TRACE_PROC_RES_FIELDS \ 32 __field(unsigned int, netns_ino) \ 33 __field(u32, xid) \ 34 __field(unsigned long, status) \ 35 __array(unsigned char, server, sizeof(struct sockaddr_in6)) \ 36 __array(unsigned char, client, sizeof(struct sockaddr_in6)) 37 38 #define NFSD_TRACE_PROC_RES_ASSIGNMENTS(error) \ 39 do { \ 40 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; \ 41 __entry->xid = be32_to_cpu(rqstp->rq_xid); \ 42 __entry->status = be32_to_cpu(error); \ 43 memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \ 44 rqstp->rq_xprt->xpt_locallen); \ 45 memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \ 46 rqstp->rq_xprt->xpt_remotelen); \ 47 } while (0); 48 49 TRACE_EVENT(nfsd_garbage_args_err, 50 TP_PROTO( 51 const struct svc_rqst *rqstp 52 ), 53 TP_ARGS(rqstp), 54 TP_STRUCT__entry( 55 NFSD_TRACE_PROC_ARG_FIELDS 56 57 __field(u32, vers) 58 __field(u32, proc) 59 ), 60 TP_fast_assign( 61 NFSD_TRACE_PROC_ARG_ASSIGNMENTS 62 63 __entry->vers = rqstp->rq_vers; 64 __entry->proc = rqstp->rq_proc; 65 ), 66 TP_printk("xid=0x%08x vers=%u proc=%u", 67 __entry->xid, __entry->vers, __entry->proc 68 ) 69 ); 70 71 TRACE_EVENT(nfsd_cant_encode_err, 72 TP_PROTO( 73 const struct svc_rqst *rqstp 74 ), 75 TP_ARGS(rqstp), 76 TP_STRUCT__entry( 77 NFSD_TRACE_PROC_ARG_FIELDS 78 79 __field(u32, vers) 80 __field(u32, proc) 81 ), 82 TP_fast_assign( 83 NFSD_TRACE_PROC_ARG_ASSIGNMENTS 84 85 __entry->vers = rqstp->rq_vers; 86 __entry->proc = rqstp->rq_proc; 87 ), 88 TP_printk("xid=0x%08x vers=%u proc=%u", 89 __entry->xid, __entry->vers, __entry->proc 90 ) 91 ); 92 93 #define show_nfsd_may_flags(x) \ 94 __print_flags(x, "|", \ 95 { NFSD_MAY_EXEC, "EXEC" }, \ 96 { NFSD_MAY_WRITE, "WRITE" }, \ 97 { NFSD_MAY_READ, "READ" }, \ 98 { NFSD_MAY_SATTR, "SATTR" }, \ 99 { NFSD_MAY_TRUNC, "TRUNC" }, \ 100 { NFSD_MAY_LOCK, "LOCK" }, \ 101 { NFSD_MAY_OWNER_OVERRIDE, "OWNER_OVERRIDE" }, \ 102 { NFSD_MAY_LOCAL_ACCESS, "LOCAL_ACCESS" }, \ 103 { NFSD_MAY_BYPASS_GSS_ON_ROOT, "BYPASS_GSS_ON_ROOT" }, \ 104 { NFSD_MAY_NOT_BREAK_LEASE, "NOT_BREAK_LEASE" }, \ 105 { NFSD_MAY_BYPASS_GSS, "BYPASS_GSS" }, \ 106 { NFSD_MAY_READ_IF_EXEC, "READ_IF_EXEC" }, \ 107 { NFSD_MAY_64BIT_COOKIE, "64BIT_COOKIE" }) 108 109 TRACE_EVENT(nfsd_compound, 110 TP_PROTO(const struct svc_rqst *rqst, 111 u32 args_opcnt), 112 TP_ARGS(rqst, args_opcnt), 113 TP_STRUCT__entry( 114 __field(u32, xid) 115 __field(u32, args_opcnt) 116 ), 117 TP_fast_assign( 118 __entry->xid = be32_to_cpu(rqst->rq_xid); 119 __entry->args_opcnt = args_opcnt; 120 ), 121 TP_printk("xid=0x%08x opcnt=%u", 122 __entry->xid, __entry->args_opcnt) 123 ) 124 125 TRACE_EVENT(nfsd_compound_status, 126 TP_PROTO(u32 args_opcnt, 127 u32 resp_opcnt, 128 __be32 status, 129 const char *name), 130 TP_ARGS(args_opcnt, resp_opcnt, status, name), 131 TP_STRUCT__entry( 132 __field(u32, args_opcnt) 133 __field(u32, resp_opcnt) 134 __field(int, status) 135 __string(name, name) 136 ), 137 TP_fast_assign( 138 __entry->args_opcnt = args_opcnt; 139 __entry->resp_opcnt = resp_opcnt; 140 __entry->status = be32_to_cpu(status); 141 __assign_str(name, name); 142 ), 143 TP_printk("op=%u/%u %s status=%d", 144 __entry->resp_opcnt, __entry->args_opcnt, 145 __get_str(name), __entry->status) 146 ) 147 148 TRACE_EVENT(nfsd_compound_decode_err, 149 TP_PROTO( 150 const struct svc_rqst *rqstp, 151 u32 args_opcnt, 152 u32 resp_opcnt, 153 u32 opnum, 154 __be32 status 155 ), 156 TP_ARGS(rqstp, args_opcnt, resp_opcnt, opnum, status), 157 TP_STRUCT__entry( 158 NFSD_TRACE_PROC_RES_FIELDS 159 160 __field(u32, args_opcnt) 161 __field(u32, resp_opcnt) 162 __field(u32, opnum) 163 ), 164 TP_fast_assign( 165 NFSD_TRACE_PROC_RES_ASSIGNMENTS(status) 166 167 __entry->args_opcnt = args_opcnt; 168 __entry->resp_opcnt = resp_opcnt; 169 __entry->opnum = opnum; 170 ), 171 TP_printk("op=%u/%u opnum=%u status=%lu", 172 __entry->resp_opcnt, __entry->args_opcnt, 173 __entry->opnum, __entry->status) 174 ); 175 176 TRACE_EVENT(nfsd_compound_encode_err, 177 TP_PROTO( 178 const struct svc_rqst *rqstp, 179 u32 opnum, 180 __be32 status 181 ), 182 TP_ARGS(rqstp, opnum, status), 183 TP_STRUCT__entry( 184 NFSD_TRACE_PROC_RES_FIELDS 185 186 __field(u32, opnum) 187 ), 188 TP_fast_assign( 189 NFSD_TRACE_PROC_RES_ASSIGNMENTS(status) 190 191 __entry->opnum = opnum; 192 ), 193 TP_printk("opnum=%u status=%lu", 194 __entry->opnum, __entry->status) 195 ); 196 197 198 DECLARE_EVENT_CLASS(nfsd_fh_err_class, 199 TP_PROTO(struct svc_rqst *rqstp, 200 struct svc_fh *fhp, 201 int status), 202 TP_ARGS(rqstp, fhp, status), 203 TP_STRUCT__entry( 204 __field(u32, xid) 205 __field(u32, fh_hash) 206 __field(int, status) 207 ), 208 TP_fast_assign( 209 __entry->xid = be32_to_cpu(rqstp->rq_xid); 210 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 211 __entry->status = status; 212 ), 213 TP_printk("xid=0x%08x fh_hash=0x%08x status=%d", 214 __entry->xid, __entry->fh_hash, 215 __entry->status) 216 ) 217 218 #define DEFINE_NFSD_FH_ERR_EVENT(name) \ 219 DEFINE_EVENT(nfsd_fh_err_class, nfsd_##name, \ 220 TP_PROTO(struct svc_rqst *rqstp, \ 221 struct svc_fh *fhp, \ 222 int status), \ 223 TP_ARGS(rqstp, fhp, status)) 224 225 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport); 226 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle); 227 228 TRACE_EVENT(nfsd_exp_find_key, 229 TP_PROTO(const struct svc_expkey *key, 230 int status), 231 TP_ARGS(key, status), 232 TP_STRUCT__entry( 233 __field(int, fsidtype) 234 __array(u32, fsid, 6) 235 __string(auth_domain, key->ek_client->name) 236 __field(int, status) 237 ), 238 TP_fast_assign( 239 __entry->fsidtype = key->ek_fsidtype; 240 memcpy(__entry->fsid, key->ek_fsid, 4*6); 241 __assign_str(auth_domain, key->ek_client->name); 242 __entry->status = status; 243 ), 244 TP_printk("fsid=%x::%s domain=%s status=%d", 245 __entry->fsidtype, 246 __print_array(__entry->fsid, 6, 4), 247 __get_str(auth_domain), 248 __entry->status 249 ) 250 ); 251 252 TRACE_EVENT(nfsd_expkey_update, 253 TP_PROTO(const struct svc_expkey *key, const char *exp_path), 254 TP_ARGS(key, exp_path), 255 TP_STRUCT__entry( 256 __field(int, fsidtype) 257 __array(u32, fsid, 6) 258 __string(auth_domain, key->ek_client->name) 259 __string(path, exp_path) 260 __field(bool, cache) 261 ), 262 TP_fast_assign( 263 __entry->fsidtype = key->ek_fsidtype; 264 memcpy(__entry->fsid, key->ek_fsid, 4*6); 265 __assign_str(auth_domain, key->ek_client->name); 266 __assign_str(path, exp_path); 267 __entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags); 268 ), 269 TP_printk("fsid=%x::%s domain=%s path=%s cache=%s", 270 __entry->fsidtype, 271 __print_array(__entry->fsid, 6, 4), 272 __get_str(auth_domain), 273 __get_str(path), 274 __entry->cache ? "pos" : "neg" 275 ) 276 ); 277 278 TRACE_EVENT(nfsd_exp_get_by_name, 279 TP_PROTO(const struct svc_export *key, 280 int status), 281 TP_ARGS(key, status), 282 TP_STRUCT__entry( 283 __string(path, key->ex_path.dentry->d_name.name) 284 __string(auth_domain, key->ex_client->name) 285 __field(int, status) 286 ), 287 TP_fast_assign( 288 __assign_str(path, key->ex_path.dentry->d_name.name); 289 __assign_str(auth_domain, key->ex_client->name); 290 __entry->status = status; 291 ), 292 TP_printk("path=%s domain=%s status=%d", 293 __get_str(path), 294 __get_str(auth_domain), 295 __entry->status 296 ) 297 ); 298 299 TRACE_EVENT(nfsd_export_update, 300 TP_PROTO(const struct svc_export *key), 301 TP_ARGS(key), 302 TP_STRUCT__entry( 303 __string(path, key->ex_path.dentry->d_name.name) 304 __string(auth_domain, key->ex_client->name) 305 __field(bool, cache) 306 ), 307 TP_fast_assign( 308 __assign_str(path, key->ex_path.dentry->d_name.name); 309 __assign_str(auth_domain, key->ex_client->name); 310 __entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags); 311 ), 312 TP_printk("path=%s domain=%s cache=%s", 313 __get_str(path), 314 __get_str(auth_domain), 315 __entry->cache ? "pos" : "neg" 316 ) 317 ); 318 319 DECLARE_EVENT_CLASS(nfsd_io_class, 320 TP_PROTO(struct svc_rqst *rqstp, 321 struct svc_fh *fhp, 322 loff_t offset, 323 unsigned long len), 324 TP_ARGS(rqstp, fhp, offset, len), 325 TP_STRUCT__entry( 326 __field(u32, xid) 327 __field(u32, fh_hash) 328 __field(loff_t, offset) 329 __field(unsigned long, len) 330 ), 331 TP_fast_assign( 332 __entry->xid = be32_to_cpu(rqstp->rq_xid); 333 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 334 __entry->offset = offset; 335 __entry->len = len; 336 ), 337 TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld len=%lu", 338 __entry->xid, __entry->fh_hash, 339 __entry->offset, __entry->len) 340 ) 341 342 #define DEFINE_NFSD_IO_EVENT(name) \ 343 DEFINE_EVENT(nfsd_io_class, nfsd_##name, \ 344 TP_PROTO(struct svc_rqst *rqstp, \ 345 struct svc_fh *fhp, \ 346 loff_t offset, \ 347 unsigned long len), \ 348 TP_ARGS(rqstp, fhp, offset, len)) 349 350 DEFINE_NFSD_IO_EVENT(read_start); 351 DEFINE_NFSD_IO_EVENT(read_splice); 352 DEFINE_NFSD_IO_EVENT(read_vector); 353 DEFINE_NFSD_IO_EVENT(read_io_done); 354 DEFINE_NFSD_IO_EVENT(read_done); 355 DEFINE_NFSD_IO_EVENT(write_start); 356 DEFINE_NFSD_IO_EVENT(write_opened); 357 DEFINE_NFSD_IO_EVENT(write_io_done); 358 DEFINE_NFSD_IO_EVENT(write_done); 359 360 DECLARE_EVENT_CLASS(nfsd_err_class, 361 TP_PROTO(struct svc_rqst *rqstp, 362 struct svc_fh *fhp, 363 loff_t offset, 364 int status), 365 TP_ARGS(rqstp, fhp, offset, status), 366 TP_STRUCT__entry( 367 __field(u32, xid) 368 __field(u32, fh_hash) 369 __field(loff_t, offset) 370 __field(int, status) 371 ), 372 TP_fast_assign( 373 __entry->xid = be32_to_cpu(rqstp->rq_xid); 374 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 375 __entry->offset = offset; 376 __entry->status = status; 377 ), 378 TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d", 379 __entry->xid, __entry->fh_hash, 380 __entry->offset, __entry->status) 381 ) 382 383 #define DEFINE_NFSD_ERR_EVENT(name) \ 384 DEFINE_EVENT(nfsd_err_class, nfsd_##name, \ 385 TP_PROTO(struct svc_rqst *rqstp, \ 386 struct svc_fh *fhp, \ 387 loff_t offset, \ 388 int len), \ 389 TP_ARGS(rqstp, fhp, offset, len)) 390 391 DEFINE_NFSD_ERR_EVENT(read_err); 392 DEFINE_NFSD_ERR_EVENT(write_err); 393 394 TRACE_EVENT(nfsd_dirent, 395 TP_PROTO(struct svc_fh *fhp, 396 u64 ino, 397 const char *name, 398 int namlen), 399 TP_ARGS(fhp, ino, name, namlen), 400 TP_STRUCT__entry( 401 __field(u32, fh_hash) 402 __field(u64, ino) 403 __field(int, len) 404 __dynamic_array(unsigned char, name, namlen) 405 ), 406 TP_fast_assign( 407 __entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0; 408 __entry->ino = ino; 409 __entry->len = namlen; 410 memcpy(__get_str(name), name, namlen); 411 ), 412 TP_printk("fh_hash=0x%08x ino=%llu name=%.*s", 413 __entry->fh_hash, __entry->ino, 414 __entry->len, __get_str(name)) 415 ) 416 417 #include "state.h" 418 #include "filecache.h" 419 #include "vfs.h" 420 421 DECLARE_EVENT_CLASS(nfsd_stateid_class, 422 TP_PROTO(stateid_t *stp), 423 TP_ARGS(stp), 424 TP_STRUCT__entry( 425 __field(u32, cl_boot) 426 __field(u32, cl_id) 427 __field(u32, si_id) 428 __field(u32, si_generation) 429 ), 430 TP_fast_assign( 431 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 432 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 433 __entry->si_id = stp->si_opaque.so_id; 434 __entry->si_generation = stp->si_generation; 435 ), 436 TP_printk("client %08x:%08x stateid %08x:%08x", 437 __entry->cl_boot, 438 __entry->cl_id, 439 __entry->si_id, 440 __entry->si_generation) 441 ) 442 443 #define DEFINE_STATEID_EVENT(name) \ 444 DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \ 445 TP_PROTO(stateid_t *stp), \ 446 TP_ARGS(stp)) 447 448 DEFINE_STATEID_EVENT(layoutstate_alloc); 449 DEFINE_STATEID_EVENT(layoutstate_unhash); 450 DEFINE_STATEID_EVENT(layoutstate_free); 451 DEFINE_STATEID_EVENT(layout_get_lookup_fail); 452 DEFINE_STATEID_EVENT(layout_commit_lookup_fail); 453 DEFINE_STATEID_EVENT(layout_return_lookup_fail); 454 DEFINE_STATEID_EVENT(layout_recall); 455 DEFINE_STATEID_EVENT(layout_recall_done); 456 DEFINE_STATEID_EVENT(layout_recall_fail); 457 DEFINE_STATEID_EVENT(layout_recall_release); 458 459 DEFINE_STATEID_EVENT(open); 460 DEFINE_STATEID_EVENT(deleg_read); 461 DEFINE_STATEID_EVENT(deleg_recall); 462 463 DECLARE_EVENT_CLASS(nfsd_stateseqid_class, 464 TP_PROTO(u32 seqid, const stateid_t *stp), 465 TP_ARGS(seqid, stp), 466 TP_STRUCT__entry( 467 __field(u32, seqid) 468 __field(u32, cl_boot) 469 __field(u32, cl_id) 470 __field(u32, si_id) 471 __field(u32, si_generation) 472 ), 473 TP_fast_assign( 474 __entry->seqid = seqid; 475 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 476 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 477 __entry->si_id = stp->si_opaque.so_id; 478 __entry->si_generation = stp->si_generation; 479 ), 480 TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x", 481 __entry->seqid, __entry->cl_boot, __entry->cl_id, 482 __entry->si_id, __entry->si_generation) 483 ) 484 485 #define DEFINE_STATESEQID_EVENT(name) \ 486 DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \ 487 TP_PROTO(u32 seqid, const stateid_t *stp), \ 488 TP_ARGS(seqid, stp)) 489 490 DEFINE_STATESEQID_EVENT(preprocess); 491 DEFINE_STATESEQID_EVENT(open_confirm); 492 493 DECLARE_EVENT_CLASS(nfsd_clientid_class, 494 TP_PROTO(const clientid_t *clid), 495 TP_ARGS(clid), 496 TP_STRUCT__entry( 497 __field(u32, cl_boot) 498 __field(u32, cl_id) 499 ), 500 TP_fast_assign( 501 __entry->cl_boot = clid->cl_boot; 502 __entry->cl_id = clid->cl_id; 503 ), 504 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 505 ) 506 507 #define DEFINE_CLIENTID_EVENT(name) \ 508 DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \ 509 TP_PROTO(const clientid_t *clid), \ 510 TP_ARGS(clid)) 511 512 DEFINE_CLIENTID_EVENT(expire_unconf); 513 DEFINE_CLIENTID_EVENT(reclaim_complete); 514 DEFINE_CLIENTID_EVENT(confirmed); 515 DEFINE_CLIENTID_EVENT(destroyed); 516 DEFINE_CLIENTID_EVENT(admin_expired); 517 DEFINE_CLIENTID_EVENT(replaced); 518 DEFINE_CLIENTID_EVENT(purged); 519 DEFINE_CLIENTID_EVENT(renew); 520 DEFINE_CLIENTID_EVENT(stale); 521 522 DECLARE_EVENT_CLASS(nfsd_net_class, 523 TP_PROTO(const struct nfsd_net *nn), 524 TP_ARGS(nn), 525 TP_STRUCT__entry( 526 __field(unsigned long long, boot_time) 527 ), 528 TP_fast_assign( 529 __entry->boot_time = nn->boot_time; 530 ), 531 TP_printk("boot_time=%16llx", __entry->boot_time) 532 ) 533 534 #define DEFINE_NET_EVENT(name) \ 535 DEFINE_EVENT(nfsd_net_class, nfsd_##name, \ 536 TP_PROTO(const struct nfsd_net *nn), \ 537 TP_ARGS(nn)) 538 539 DEFINE_NET_EVENT(grace_start); 540 DEFINE_NET_EVENT(grace_complete); 541 542 TRACE_EVENT(nfsd_clid_cred_mismatch, 543 TP_PROTO( 544 const struct nfs4_client *clp, 545 const struct svc_rqst *rqstp 546 ), 547 TP_ARGS(clp, rqstp), 548 TP_STRUCT__entry( 549 __field(u32, cl_boot) 550 __field(u32, cl_id) 551 __field(unsigned long, cl_flavor) 552 __field(unsigned long, new_flavor) 553 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 554 ), 555 TP_fast_assign( 556 __entry->cl_boot = clp->cl_clientid.cl_boot; 557 __entry->cl_id = clp->cl_clientid.cl_id; 558 __entry->cl_flavor = clp->cl_cred.cr_flavor; 559 __entry->new_flavor = rqstp->rq_cred.cr_flavor; 560 memcpy(__entry->addr, &rqstp->rq_xprt->xpt_remote, 561 sizeof(struct sockaddr_in6)); 562 ), 563 TP_printk("client %08x:%08x flavor=%s, conflict=%s from addr=%pISpc", 564 __entry->cl_boot, __entry->cl_id, 565 show_nfsd_authflavor(__entry->cl_flavor), 566 show_nfsd_authflavor(__entry->new_flavor), __entry->addr 567 ) 568 ) 569 570 TRACE_EVENT(nfsd_clid_verf_mismatch, 571 TP_PROTO( 572 const struct nfs4_client *clp, 573 const struct svc_rqst *rqstp, 574 const nfs4_verifier *verf 575 ), 576 TP_ARGS(clp, rqstp, verf), 577 TP_STRUCT__entry( 578 __field(u32, cl_boot) 579 __field(u32, cl_id) 580 __array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE) 581 __array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE) 582 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 583 ), 584 TP_fast_assign( 585 __entry->cl_boot = clp->cl_clientid.cl_boot; 586 __entry->cl_id = clp->cl_clientid.cl_id; 587 memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier, 588 NFS4_VERIFIER_SIZE); 589 memcpy(__entry->new_verifier, (void *)verf, 590 NFS4_VERIFIER_SIZE); 591 memcpy(__entry->addr, &rqstp->rq_xprt->xpt_remote, 592 sizeof(struct sockaddr_in6)); 593 ), 594 TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc", 595 __entry->cl_boot, __entry->cl_id, 596 __print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE), 597 __print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE), 598 __entry->addr 599 ) 600 ); 601 602 DECLARE_EVENT_CLASS(nfsd_clid_class, 603 TP_PROTO(const struct nfs4_client *clp), 604 TP_ARGS(clp), 605 TP_STRUCT__entry( 606 __field(u32, cl_boot) 607 __field(u32, cl_id) 608 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 609 __field(unsigned long, flavor) 610 __array(unsigned char, verifier, NFS4_VERIFIER_SIZE) 611 __dynamic_array(char, name, clp->cl_name.len + 1) 612 ), 613 TP_fast_assign( 614 __entry->cl_boot = clp->cl_clientid.cl_boot; 615 __entry->cl_id = clp->cl_clientid.cl_id; 616 memcpy(__entry->addr, &clp->cl_addr, 617 sizeof(struct sockaddr_in6)); 618 __entry->flavor = clp->cl_cred.cr_flavor; 619 memcpy(__entry->verifier, (void *)&clp->cl_verifier, 620 NFS4_VERIFIER_SIZE); 621 memcpy(__get_str(name), clp->cl_name.data, clp->cl_name.len); 622 __get_str(name)[clp->cl_name.len] = '\0'; 623 ), 624 TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x", 625 __entry->addr, __get_str(name), 626 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE), 627 show_nfsd_authflavor(__entry->flavor), 628 __entry->cl_boot, __entry->cl_id) 629 ); 630 631 #define DEFINE_CLID_EVENT(name) \ 632 DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \ 633 TP_PROTO(const struct nfs4_client *clp), \ 634 TP_ARGS(clp)) 635 636 DEFINE_CLID_EVENT(fresh); 637 DEFINE_CLID_EVENT(confirmed_r); 638 639 /* 640 * from fs/nfsd/filecache.h 641 */ 642 TRACE_DEFINE_ENUM(NFSD_FILE_HASHED); 643 TRACE_DEFINE_ENUM(NFSD_FILE_PENDING); 644 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ); 645 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE); 646 TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED); 647 648 #define show_nf_flags(val) \ 649 __print_flags(val, "|", \ 650 { 1 << NFSD_FILE_HASHED, "HASHED" }, \ 651 { 1 << NFSD_FILE_PENDING, "PENDING" }, \ 652 { 1 << NFSD_FILE_BREAK_READ, "BREAK_READ" }, \ 653 { 1 << NFSD_FILE_BREAK_WRITE, "BREAK_WRITE" }, \ 654 { 1 << NFSD_FILE_REFERENCED, "REFERENCED"}) 655 656 DECLARE_EVENT_CLASS(nfsd_file_class, 657 TP_PROTO(struct nfsd_file *nf), 658 TP_ARGS(nf), 659 TP_STRUCT__entry( 660 __field(unsigned int, nf_hashval) 661 __field(void *, nf_inode) 662 __field(int, nf_ref) 663 __field(unsigned long, nf_flags) 664 __field(unsigned char, nf_may) 665 __field(struct file *, nf_file) 666 ), 667 TP_fast_assign( 668 __entry->nf_hashval = nf->nf_hashval; 669 __entry->nf_inode = nf->nf_inode; 670 __entry->nf_ref = refcount_read(&nf->nf_ref); 671 __entry->nf_flags = nf->nf_flags; 672 __entry->nf_may = nf->nf_may; 673 __entry->nf_file = nf->nf_file; 674 ), 675 TP_printk("hash=0x%x inode=%p ref=%d flags=%s may=%s file=%p", 676 __entry->nf_hashval, 677 __entry->nf_inode, 678 __entry->nf_ref, 679 show_nf_flags(__entry->nf_flags), 680 show_nfsd_may_flags(__entry->nf_may), 681 __entry->nf_file) 682 ) 683 684 #define DEFINE_NFSD_FILE_EVENT(name) \ 685 DEFINE_EVENT(nfsd_file_class, name, \ 686 TP_PROTO(struct nfsd_file *nf), \ 687 TP_ARGS(nf)) 688 689 DEFINE_NFSD_FILE_EVENT(nfsd_file_alloc); 690 DEFINE_NFSD_FILE_EVENT(nfsd_file_put_final); 691 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash); 692 DEFINE_NFSD_FILE_EVENT(nfsd_file_put); 693 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_release_locked); 694 695 TRACE_EVENT(nfsd_file_acquire, 696 TP_PROTO(struct svc_rqst *rqstp, unsigned int hash, 697 struct inode *inode, unsigned int may_flags, 698 struct nfsd_file *nf, __be32 status), 699 700 TP_ARGS(rqstp, hash, inode, may_flags, nf, status), 701 702 TP_STRUCT__entry( 703 __field(u32, xid) 704 __field(unsigned int, hash) 705 __field(void *, inode) 706 __field(unsigned long, may_flags) 707 __field(int, nf_ref) 708 __field(unsigned long, nf_flags) 709 __field(unsigned long, nf_may) 710 __field(struct file *, nf_file) 711 __field(u32, status) 712 ), 713 714 TP_fast_assign( 715 __entry->xid = be32_to_cpu(rqstp->rq_xid); 716 __entry->hash = hash; 717 __entry->inode = inode; 718 __entry->may_flags = may_flags; 719 __entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0; 720 __entry->nf_flags = nf ? nf->nf_flags : 0; 721 __entry->nf_may = nf ? nf->nf_may : 0; 722 __entry->nf_file = nf ? nf->nf_file : NULL; 723 __entry->status = be32_to_cpu(status); 724 ), 725 726 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", 727 __entry->xid, __entry->hash, __entry->inode, 728 show_nfsd_may_flags(__entry->may_flags), 729 __entry->nf_ref, show_nf_flags(__entry->nf_flags), 730 show_nfsd_may_flags(__entry->nf_may), 731 __entry->nf_file, __entry->status) 732 ); 733 734 DECLARE_EVENT_CLASS(nfsd_file_search_class, 735 TP_PROTO(struct inode *inode, unsigned int hash, int found), 736 TP_ARGS(inode, hash, found), 737 TP_STRUCT__entry( 738 __field(struct inode *, inode) 739 __field(unsigned int, hash) 740 __field(int, found) 741 ), 742 TP_fast_assign( 743 __entry->inode = inode; 744 __entry->hash = hash; 745 __entry->found = found; 746 ), 747 TP_printk("hash=0x%x inode=%p found=%d", __entry->hash, 748 __entry->inode, __entry->found) 749 ); 750 751 #define DEFINE_NFSD_FILE_SEARCH_EVENT(name) \ 752 DEFINE_EVENT(nfsd_file_search_class, name, \ 753 TP_PROTO(struct inode *inode, unsigned int hash, int found), \ 754 TP_ARGS(inode, hash, found)) 755 756 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync); 757 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode); 758 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_is_cached); 759 760 TRACE_EVENT(nfsd_file_fsnotify_handle_event, 761 TP_PROTO(struct inode *inode, u32 mask), 762 TP_ARGS(inode, mask), 763 TP_STRUCT__entry( 764 __field(struct inode *, inode) 765 __field(unsigned int, nlink) 766 __field(umode_t, mode) 767 __field(u32, mask) 768 ), 769 TP_fast_assign( 770 __entry->inode = inode; 771 __entry->nlink = inode->i_nlink; 772 __entry->mode = inode->i_mode; 773 __entry->mask = mask; 774 ), 775 TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode, 776 __entry->nlink, __entry->mode, __entry->mask) 777 ); 778 779 #include "cache.h" 780 781 TRACE_DEFINE_ENUM(RC_DROPIT); 782 TRACE_DEFINE_ENUM(RC_REPLY); 783 TRACE_DEFINE_ENUM(RC_DOIT); 784 785 #define show_drc_retval(x) \ 786 __print_symbolic(x, \ 787 { RC_DROPIT, "DROPIT" }, \ 788 { RC_REPLY, "REPLY" }, \ 789 { RC_DOIT, "DOIT" }) 790 791 TRACE_EVENT(nfsd_drc_found, 792 TP_PROTO( 793 const struct nfsd_net *nn, 794 const struct svc_rqst *rqstp, 795 int result 796 ), 797 TP_ARGS(nn, rqstp, result), 798 TP_STRUCT__entry( 799 __field(unsigned long long, boot_time) 800 __field(unsigned long, result) 801 __field(u32, xid) 802 ), 803 TP_fast_assign( 804 __entry->boot_time = nn->boot_time; 805 __entry->result = result; 806 __entry->xid = be32_to_cpu(rqstp->rq_xid); 807 ), 808 TP_printk("boot_time=%16llx xid=0x%08x result=%s", 809 __entry->boot_time, __entry->xid, 810 show_drc_retval(__entry->result)) 811 812 ); 813 814 TRACE_EVENT(nfsd_drc_mismatch, 815 TP_PROTO( 816 const struct nfsd_net *nn, 817 const struct svc_cacherep *key, 818 const struct svc_cacherep *rp 819 ), 820 TP_ARGS(nn, key, rp), 821 TP_STRUCT__entry( 822 __field(unsigned long long, boot_time) 823 __field(u32, xid) 824 __field(u32, cached) 825 __field(u32, ingress) 826 ), 827 TP_fast_assign( 828 __entry->boot_time = nn->boot_time; 829 __entry->xid = be32_to_cpu(key->c_key.k_xid); 830 __entry->cached = (__force u32)key->c_key.k_csum; 831 __entry->ingress = (__force u32)rp->c_key.k_csum; 832 ), 833 TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x", 834 __entry->boot_time, __entry->xid, __entry->cached, 835 __entry->ingress) 836 ); 837 838 TRACE_EVENT(nfsd_cb_args, 839 TP_PROTO( 840 const struct nfs4_client *clp, 841 const struct nfs4_cb_conn *conn 842 ), 843 TP_ARGS(clp, conn), 844 TP_STRUCT__entry( 845 __field(u32, cl_boot) 846 __field(u32, cl_id) 847 __field(u32, prog) 848 __field(u32, ident) 849 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 850 ), 851 TP_fast_assign( 852 __entry->cl_boot = clp->cl_clientid.cl_boot; 853 __entry->cl_id = clp->cl_clientid.cl_id; 854 __entry->prog = conn->cb_prog; 855 __entry->ident = conn->cb_ident; 856 memcpy(__entry->addr, &conn->cb_addr, 857 sizeof(struct sockaddr_in6)); 858 ), 859 TP_printk("addr=%pISpc client %08x:%08x prog=%u ident=%u", 860 __entry->addr, __entry->cl_boot, __entry->cl_id, 861 __entry->prog, __entry->ident) 862 ); 863 864 TRACE_EVENT(nfsd_cb_nodelegs, 865 TP_PROTO(const struct nfs4_client *clp), 866 TP_ARGS(clp), 867 TP_STRUCT__entry( 868 __field(u32, cl_boot) 869 __field(u32, cl_id) 870 ), 871 TP_fast_assign( 872 __entry->cl_boot = clp->cl_clientid.cl_boot; 873 __entry->cl_id = clp->cl_clientid.cl_id; 874 ), 875 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 876 ) 877 878 #define show_cb_state(val) \ 879 __print_symbolic(val, \ 880 { NFSD4_CB_UP, "UP" }, \ 881 { NFSD4_CB_UNKNOWN, "UNKNOWN" }, \ 882 { NFSD4_CB_DOWN, "DOWN" }, \ 883 { NFSD4_CB_FAULT, "FAULT"}) 884 885 DECLARE_EVENT_CLASS(nfsd_cb_class, 886 TP_PROTO(const struct nfs4_client *clp), 887 TP_ARGS(clp), 888 TP_STRUCT__entry( 889 __field(unsigned long, state) 890 __field(u32, cl_boot) 891 __field(u32, cl_id) 892 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 893 ), 894 TP_fast_assign( 895 __entry->state = clp->cl_cb_state; 896 __entry->cl_boot = clp->cl_clientid.cl_boot; 897 __entry->cl_id = clp->cl_clientid.cl_id; 898 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 899 sizeof(struct sockaddr_in6)); 900 ), 901 TP_printk("addr=%pISpc client %08x:%08x state=%s", 902 __entry->addr, __entry->cl_boot, __entry->cl_id, 903 show_cb_state(__entry->state)) 904 ); 905 906 #define DEFINE_NFSD_CB_EVENT(name) \ 907 DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name, \ 908 TP_PROTO(const struct nfs4_client *clp), \ 909 TP_ARGS(clp)) 910 911 DEFINE_NFSD_CB_EVENT(state); 912 DEFINE_NFSD_CB_EVENT(probe); 913 DEFINE_NFSD_CB_EVENT(lost); 914 DEFINE_NFSD_CB_EVENT(shutdown); 915 916 TRACE_DEFINE_ENUM(RPC_AUTH_NULL); 917 TRACE_DEFINE_ENUM(RPC_AUTH_UNIX); 918 TRACE_DEFINE_ENUM(RPC_AUTH_GSS); 919 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 920 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 921 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 922 923 #define show_nfsd_authflavor(val) \ 924 __print_symbolic(val, \ 925 { RPC_AUTH_NULL, "none" }, \ 926 { RPC_AUTH_UNIX, "sys" }, \ 927 { RPC_AUTH_GSS, "gss" }, \ 928 { RPC_AUTH_GSS_KRB5, "krb5" }, \ 929 { RPC_AUTH_GSS_KRB5I, "krb5i" }, \ 930 { RPC_AUTH_GSS_KRB5P, "krb5p" }) 931 932 TRACE_EVENT(nfsd_cb_setup, 933 TP_PROTO(const struct nfs4_client *clp, 934 const char *netid, 935 rpc_authflavor_t authflavor 936 ), 937 TP_ARGS(clp, netid, authflavor), 938 TP_STRUCT__entry( 939 __field(u32, cl_boot) 940 __field(u32, cl_id) 941 __field(unsigned long, authflavor) 942 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 943 __array(unsigned char, netid, 8) 944 ), 945 TP_fast_assign( 946 __entry->cl_boot = clp->cl_clientid.cl_boot; 947 __entry->cl_id = clp->cl_clientid.cl_id; 948 strlcpy(__entry->netid, netid, sizeof(__entry->netid)); 949 __entry->authflavor = authflavor; 950 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 951 sizeof(struct sockaddr_in6)); 952 ), 953 TP_printk("addr=%pISpc client %08x:%08x proto=%s flavor=%s", 954 __entry->addr, __entry->cl_boot, __entry->cl_id, 955 __entry->netid, show_nfsd_authflavor(__entry->authflavor)) 956 ); 957 958 TRACE_EVENT(nfsd_cb_setup_err, 959 TP_PROTO( 960 const struct nfs4_client *clp, 961 long error 962 ), 963 TP_ARGS(clp, error), 964 TP_STRUCT__entry( 965 __field(long, error) 966 __field(u32, cl_boot) 967 __field(u32, cl_id) 968 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 969 ), 970 TP_fast_assign( 971 __entry->error = error; 972 __entry->cl_boot = clp->cl_clientid.cl_boot; 973 __entry->cl_id = clp->cl_clientid.cl_id; 974 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 975 sizeof(struct sockaddr_in6)); 976 ), 977 TP_printk("addr=%pISpc client %08x:%08x error=%ld", 978 __entry->addr, __entry->cl_boot, __entry->cl_id, __entry->error) 979 ); 980 981 TRACE_EVENT(nfsd_cb_recall, 982 TP_PROTO( 983 const struct nfs4_stid *stid 984 ), 985 TP_ARGS(stid), 986 TP_STRUCT__entry( 987 __field(u32, cl_boot) 988 __field(u32, cl_id) 989 __field(u32, si_id) 990 __field(u32, si_generation) 991 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 992 ), 993 TP_fast_assign( 994 const stateid_t *stp = &stid->sc_stateid; 995 const struct nfs4_client *clp = stid->sc_client; 996 997 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 998 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 999 __entry->si_id = stp->si_opaque.so_id; 1000 __entry->si_generation = stp->si_generation; 1001 if (clp) 1002 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 1003 sizeof(struct sockaddr_in6)); 1004 else 1005 memset(__entry->addr, 0, sizeof(struct sockaddr_in6)); 1006 ), 1007 TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x", 1008 __entry->addr, __entry->cl_boot, __entry->cl_id, 1009 __entry->si_id, __entry->si_generation) 1010 ); 1011 1012 TRACE_EVENT(nfsd_cb_notify_lock, 1013 TP_PROTO( 1014 const struct nfs4_lockowner *lo, 1015 const struct nfsd4_blocked_lock *nbl 1016 ), 1017 TP_ARGS(lo, nbl), 1018 TP_STRUCT__entry( 1019 __field(u32, cl_boot) 1020 __field(u32, cl_id) 1021 __field(u32, fh_hash) 1022 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 1023 ), 1024 TP_fast_assign( 1025 const struct nfs4_client *clp = lo->lo_owner.so_client; 1026 1027 __entry->cl_boot = clp->cl_clientid.cl_boot; 1028 __entry->cl_id = clp->cl_clientid.cl_id; 1029 __entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh); 1030 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 1031 sizeof(struct sockaddr_in6)); 1032 ), 1033 TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x", 1034 __entry->addr, __entry->cl_boot, __entry->cl_id, 1035 __entry->fh_hash) 1036 ); 1037 1038 TRACE_EVENT(nfsd_cb_offload, 1039 TP_PROTO( 1040 const struct nfs4_client *clp, 1041 const stateid_t *stp, 1042 const struct knfsd_fh *fh, 1043 u64 count, 1044 __be32 status 1045 ), 1046 TP_ARGS(clp, stp, fh, count, status), 1047 TP_STRUCT__entry( 1048 __field(u32, cl_boot) 1049 __field(u32, cl_id) 1050 __field(u32, si_id) 1051 __field(u32, si_generation) 1052 __field(u32, fh_hash) 1053 __field(int, status) 1054 __field(u64, count) 1055 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 1056 ), 1057 TP_fast_assign( 1058 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 1059 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 1060 __entry->si_id = stp->si_opaque.so_id; 1061 __entry->si_generation = stp->si_generation; 1062 __entry->fh_hash = knfsd_fh_hash(fh); 1063 __entry->status = be32_to_cpu(status); 1064 __entry->count = count; 1065 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 1066 sizeof(struct sockaddr_in6)); 1067 ), 1068 TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x fh_hash=0x%08x count=%llu status=%d", 1069 __entry->addr, __entry->cl_boot, __entry->cl_id, 1070 __entry->si_id, __entry->si_generation, 1071 __entry->fh_hash, __entry->count, __entry->status) 1072 ); 1073 1074 #endif /* _NFSD_TRACE_H */ 1075 1076 #undef TRACE_INCLUDE_PATH 1077 #define TRACE_INCLUDE_PATH . 1078 #define TRACE_INCLUDE_FILE trace 1079 #include <trace/define_trace.h> 1080