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