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 __assign_str(name, name); 412 ), 413 TP_printk("fh_hash=0x%08x ino=%llu name=%.*s", 414 __entry->fh_hash, __entry->ino, 415 __entry->len, __get_str(name)) 416 ) 417 418 #include "state.h" 419 #include "filecache.h" 420 #include "vfs.h" 421 422 DECLARE_EVENT_CLASS(nfsd_stateid_class, 423 TP_PROTO(stateid_t *stp), 424 TP_ARGS(stp), 425 TP_STRUCT__entry( 426 __field(u32, cl_boot) 427 __field(u32, cl_id) 428 __field(u32, si_id) 429 __field(u32, si_generation) 430 ), 431 TP_fast_assign( 432 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 433 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 434 __entry->si_id = stp->si_opaque.so_id; 435 __entry->si_generation = stp->si_generation; 436 ), 437 TP_printk("client %08x:%08x stateid %08x:%08x", 438 __entry->cl_boot, 439 __entry->cl_id, 440 __entry->si_id, 441 __entry->si_generation) 442 ) 443 444 #define DEFINE_STATEID_EVENT(name) \ 445 DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \ 446 TP_PROTO(stateid_t *stp), \ 447 TP_ARGS(stp)) 448 449 DEFINE_STATEID_EVENT(layoutstate_alloc); 450 DEFINE_STATEID_EVENT(layoutstate_unhash); 451 DEFINE_STATEID_EVENT(layoutstate_free); 452 DEFINE_STATEID_EVENT(layout_get_lookup_fail); 453 DEFINE_STATEID_EVENT(layout_commit_lookup_fail); 454 DEFINE_STATEID_EVENT(layout_return_lookup_fail); 455 DEFINE_STATEID_EVENT(layout_recall); 456 DEFINE_STATEID_EVENT(layout_recall_done); 457 DEFINE_STATEID_EVENT(layout_recall_fail); 458 DEFINE_STATEID_EVENT(layout_recall_release); 459 460 DEFINE_STATEID_EVENT(open); 461 DEFINE_STATEID_EVENT(deleg_read); 462 DEFINE_STATEID_EVENT(deleg_break); 463 DEFINE_STATEID_EVENT(deleg_recall); 464 465 DECLARE_EVENT_CLASS(nfsd_stateseqid_class, 466 TP_PROTO(u32 seqid, const stateid_t *stp), 467 TP_ARGS(seqid, stp), 468 TP_STRUCT__entry( 469 __field(u32, seqid) 470 __field(u32, cl_boot) 471 __field(u32, cl_id) 472 __field(u32, si_id) 473 __field(u32, si_generation) 474 ), 475 TP_fast_assign( 476 __entry->seqid = seqid; 477 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 478 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 479 __entry->si_id = stp->si_opaque.so_id; 480 __entry->si_generation = stp->si_generation; 481 ), 482 TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x", 483 __entry->seqid, __entry->cl_boot, __entry->cl_id, 484 __entry->si_id, __entry->si_generation) 485 ) 486 487 #define DEFINE_STATESEQID_EVENT(name) \ 488 DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \ 489 TP_PROTO(u32 seqid, const stateid_t *stp), \ 490 TP_ARGS(seqid, stp)) 491 492 DEFINE_STATESEQID_EVENT(preprocess); 493 DEFINE_STATESEQID_EVENT(open_confirm); 494 495 DECLARE_EVENT_CLASS(nfsd_clientid_class, 496 TP_PROTO(const clientid_t *clid), 497 TP_ARGS(clid), 498 TP_STRUCT__entry( 499 __field(u32, cl_boot) 500 __field(u32, cl_id) 501 ), 502 TP_fast_assign( 503 __entry->cl_boot = clid->cl_boot; 504 __entry->cl_id = clid->cl_id; 505 ), 506 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 507 ) 508 509 #define DEFINE_CLIENTID_EVENT(name) \ 510 DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \ 511 TP_PROTO(const clientid_t *clid), \ 512 TP_ARGS(clid)) 513 514 DEFINE_CLIENTID_EVENT(expire_unconf); 515 DEFINE_CLIENTID_EVENT(reclaim_complete); 516 DEFINE_CLIENTID_EVENT(confirmed); 517 DEFINE_CLIENTID_EVENT(destroyed); 518 DEFINE_CLIENTID_EVENT(admin_expired); 519 DEFINE_CLIENTID_EVENT(replaced); 520 DEFINE_CLIENTID_EVENT(purged); 521 DEFINE_CLIENTID_EVENT(renew); 522 DEFINE_CLIENTID_EVENT(stale); 523 524 DECLARE_EVENT_CLASS(nfsd_net_class, 525 TP_PROTO(const struct nfsd_net *nn), 526 TP_ARGS(nn), 527 TP_STRUCT__entry( 528 __field(unsigned long long, boot_time) 529 ), 530 TP_fast_assign( 531 __entry->boot_time = nn->boot_time; 532 ), 533 TP_printk("boot_time=%16llx", __entry->boot_time) 534 ) 535 536 #define DEFINE_NET_EVENT(name) \ 537 DEFINE_EVENT(nfsd_net_class, nfsd_##name, \ 538 TP_PROTO(const struct nfsd_net *nn), \ 539 TP_ARGS(nn)) 540 541 DEFINE_NET_EVENT(grace_start); 542 DEFINE_NET_EVENT(grace_complete); 543 544 TRACE_EVENT(nfsd_clid_cred_mismatch, 545 TP_PROTO( 546 const struct nfs4_client *clp, 547 const struct svc_rqst *rqstp 548 ), 549 TP_ARGS(clp, rqstp), 550 TP_STRUCT__entry( 551 __field(u32, cl_boot) 552 __field(u32, cl_id) 553 __field(unsigned long, cl_flavor) 554 __field(unsigned long, new_flavor) 555 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 556 ), 557 TP_fast_assign( 558 __entry->cl_boot = clp->cl_clientid.cl_boot; 559 __entry->cl_id = clp->cl_clientid.cl_id; 560 __entry->cl_flavor = clp->cl_cred.cr_flavor; 561 __entry->new_flavor = rqstp->rq_cred.cr_flavor; 562 memcpy(__entry->addr, &rqstp->rq_xprt->xpt_remote, 563 sizeof(struct sockaddr_in6)); 564 ), 565 TP_printk("client %08x:%08x flavor=%s, conflict=%s from addr=%pISpc", 566 __entry->cl_boot, __entry->cl_id, 567 show_nfsd_authflavor(__entry->cl_flavor), 568 show_nfsd_authflavor(__entry->new_flavor), __entry->addr 569 ) 570 ) 571 572 TRACE_EVENT(nfsd_clid_verf_mismatch, 573 TP_PROTO( 574 const struct nfs4_client *clp, 575 const struct svc_rqst *rqstp, 576 const nfs4_verifier *verf 577 ), 578 TP_ARGS(clp, rqstp, verf), 579 TP_STRUCT__entry( 580 __field(u32, cl_boot) 581 __field(u32, cl_id) 582 __array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE) 583 __array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE) 584 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 585 ), 586 TP_fast_assign( 587 __entry->cl_boot = clp->cl_clientid.cl_boot; 588 __entry->cl_id = clp->cl_clientid.cl_id; 589 memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier, 590 NFS4_VERIFIER_SIZE); 591 memcpy(__entry->new_verifier, (void *)verf, 592 NFS4_VERIFIER_SIZE); 593 memcpy(__entry->addr, &rqstp->rq_xprt->xpt_remote, 594 sizeof(struct sockaddr_in6)); 595 ), 596 TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc", 597 __entry->cl_boot, __entry->cl_id, 598 __print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE), 599 __print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE), 600 __entry->addr 601 ) 602 ); 603 604 DECLARE_EVENT_CLASS(nfsd_clid_class, 605 TP_PROTO(const struct nfs4_client *clp), 606 TP_ARGS(clp), 607 TP_STRUCT__entry( 608 __field(u32, cl_boot) 609 __field(u32, cl_id) 610 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 611 __field(unsigned long, flavor) 612 __array(unsigned char, verifier, NFS4_VERIFIER_SIZE) 613 __dynamic_array(char, name, clp->cl_name.len + 1) 614 ), 615 TP_fast_assign( 616 __entry->cl_boot = clp->cl_clientid.cl_boot; 617 __entry->cl_id = clp->cl_clientid.cl_id; 618 memcpy(__entry->addr, &clp->cl_addr, 619 sizeof(struct sockaddr_in6)); 620 __entry->flavor = clp->cl_cred.cr_flavor; 621 memcpy(__entry->verifier, (void *)&clp->cl_verifier, 622 NFS4_VERIFIER_SIZE); 623 memcpy(__get_str(name), clp->cl_name.data, clp->cl_name.len); 624 __get_str(name)[clp->cl_name.len] = '\0'; 625 ), 626 TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x", 627 __entry->addr, __get_str(name), 628 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE), 629 show_nfsd_authflavor(__entry->flavor), 630 __entry->cl_boot, __entry->cl_id) 631 ); 632 633 #define DEFINE_CLID_EVENT(name) \ 634 DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \ 635 TP_PROTO(const struct nfs4_client *clp), \ 636 TP_ARGS(clp)) 637 638 DEFINE_CLID_EVENT(fresh); 639 DEFINE_CLID_EVENT(confirmed_r); 640 641 /* 642 * from fs/nfsd/filecache.h 643 */ 644 TRACE_DEFINE_ENUM(NFSD_FILE_HASHED); 645 TRACE_DEFINE_ENUM(NFSD_FILE_PENDING); 646 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ); 647 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE); 648 TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED); 649 650 #define show_nf_flags(val) \ 651 __print_flags(val, "|", \ 652 { 1 << NFSD_FILE_HASHED, "HASHED" }, \ 653 { 1 << NFSD_FILE_PENDING, "PENDING" }, \ 654 { 1 << NFSD_FILE_BREAK_READ, "BREAK_READ" }, \ 655 { 1 << NFSD_FILE_BREAK_WRITE, "BREAK_WRITE" }, \ 656 { 1 << NFSD_FILE_REFERENCED, "REFERENCED"}) 657 658 DECLARE_EVENT_CLASS(nfsd_file_class, 659 TP_PROTO(struct nfsd_file *nf), 660 TP_ARGS(nf), 661 TP_STRUCT__entry( 662 __field(unsigned int, nf_hashval) 663 __field(void *, nf_inode) 664 __field(int, nf_ref) 665 __field(unsigned long, nf_flags) 666 __field(unsigned char, nf_may) 667 __field(struct file *, nf_file) 668 ), 669 TP_fast_assign( 670 __entry->nf_hashval = nf->nf_hashval; 671 __entry->nf_inode = nf->nf_inode; 672 __entry->nf_ref = refcount_read(&nf->nf_ref); 673 __entry->nf_flags = nf->nf_flags; 674 __entry->nf_may = nf->nf_may; 675 __entry->nf_file = nf->nf_file; 676 ), 677 TP_printk("hash=0x%x inode=%p ref=%d flags=%s may=%s file=%p", 678 __entry->nf_hashval, 679 __entry->nf_inode, 680 __entry->nf_ref, 681 show_nf_flags(__entry->nf_flags), 682 show_nfsd_may_flags(__entry->nf_may), 683 __entry->nf_file) 684 ) 685 686 #define DEFINE_NFSD_FILE_EVENT(name) \ 687 DEFINE_EVENT(nfsd_file_class, name, \ 688 TP_PROTO(struct nfsd_file *nf), \ 689 TP_ARGS(nf)) 690 691 DEFINE_NFSD_FILE_EVENT(nfsd_file_alloc); 692 DEFINE_NFSD_FILE_EVENT(nfsd_file_put_final); 693 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash); 694 DEFINE_NFSD_FILE_EVENT(nfsd_file_put); 695 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_release_locked); 696 697 TRACE_EVENT(nfsd_file_acquire, 698 TP_PROTO(struct svc_rqst *rqstp, unsigned int hash, 699 struct inode *inode, unsigned int may_flags, 700 struct nfsd_file *nf, __be32 status), 701 702 TP_ARGS(rqstp, hash, inode, may_flags, nf, status), 703 704 TP_STRUCT__entry( 705 __field(u32, xid) 706 __field(unsigned int, hash) 707 __field(void *, inode) 708 __field(unsigned long, may_flags) 709 __field(int, nf_ref) 710 __field(unsigned long, nf_flags) 711 __field(unsigned long, nf_may) 712 __field(struct file *, nf_file) 713 __field(u32, status) 714 ), 715 716 TP_fast_assign( 717 __entry->xid = be32_to_cpu(rqstp->rq_xid); 718 __entry->hash = hash; 719 __entry->inode = inode; 720 __entry->may_flags = may_flags; 721 __entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0; 722 __entry->nf_flags = nf ? nf->nf_flags : 0; 723 __entry->nf_may = nf ? nf->nf_may : 0; 724 __entry->nf_file = nf ? nf->nf_file : NULL; 725 __entry->status = be32_to_cpu(status); 726 ), 727 728 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", 729 __entry->xid, __entry->hash, __entry->inode, 730 show_nfsd_may_flags(__entry->may_flags), 731 __entry->nf_ref, show_nf_flags(__entry->nf_flags), 732 show_nfsd_may_flags(__entry->nf_may), 733 __entry->nf_file, __entry->status) 734 ); 735 736 DECLARE_EVENT_CLASS(nfsd_file_search_class, 737 TP_PROTO(struct inode *inode, unsigned int hash, int found), 738 TP_ARGS(inode, hash, found), 739 TP_STRUCT__entry( 740 __field(struct inode *, inode) 741 __field(unsigned int, hash) 742 __field(int, found) 743 ), 744 TP_fast_assign( 745 __entry->inode = inode; 746 __entry->hash = hash; 747 __entry->found = found; 748 ), 749 TP_printk("hash=0x%x inode=%p found=%d", __entry->hash, 750 __entry->inode, __entry->found) 751 ); 752 753 #define DEFINE_NFSD_FILE_SEARCH_EVENT(name) \ 754 DEFINE_EVENT(nfsd_file_search_class, name, \ 755 TP_PROTO(struct inode *inode, unsigned int hash, int found), \ 756 TP_ARGS(inode, hash, found)) 757 758 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync); 759 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode); 760 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_is_cached); 761 762 TRACE_EVENT(nfsd_file_fsnotify_handle_event, 763 TP_PROTO(struct inode *inode, u32 mask), 764 TP_ARGS(inode, mask), 765 TP_STRUCT__entry( 766 __field(struct inode *, inode) 767 __field(unsigned int, nlink) 768 __field(umode_t, mode) 769 __field(u32, mask) 770 ), 771 TP_fast_assign( 772 __entry->inode = inode; 773 __entry->nlink = inode->i_nlink; 774 __entry->mode = inode->i_mode; 775 __entry->mask = mask; 776 ), 777 TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode, 778 __entry->nlink, __entry->mode, __entry->mask) 779 ); 780 781 #include "cache.h" 782 783 TRACE_DEFINE_ENUM(RC_DROPIT); 784 TRACE_DEFINE_ENUM(RC_REPLY); 785 TRACE_DEFINE_ENUM(RC_DOIT); 786 787 #define show_drc_retval(x) \ 788 __print_symbolic(x, \ 789 { RC_DROPIT, "DROPIT" }, \ 790 { RC_REPLY, "REPLY" }, \ 791 { RC_DOIT, "DOIT" }) 792 793 TRACE_EVENT(nfsd_drc_found, 794 TP_PROTO( 795 const struct nfsd_net *nn, 796 const struct svc_rqst *rqstp, 797 int result 798 ), 799 TP_ARGS(nn, rqstp, result), 800 TP_STRUCT__entry( 801 __field(unsigned long long, boot_time) 802 __field(unsigned long, result) 803 __field(u32, xid) 804 ), 805 TP_fast_assign( 806 __entry->boot_time = nn->boot_time; 807 __entry->result = result; 808 __entry->xid = be32_to_cpu(rqstp->rq_xid); 809 ), 810 TP_printk("boot_time=%16llx xid=0x%08x result=%s", 811 __entry->boot_time, __entry->xid, 812 show_drc_retval(__entry->result)) 813 814 ); 815 816 TRACE_EVENT(nfsd_drc_mismatch, 817 TP_PROTO( 818 const struct nfsd_net *nn, 819 const struct svc_cacherep *key, 820 const struct svc_cacherep *rp 821 ), 822 TP_ARGS(nn, key, rp), 823 TP_STRUCT__entry( 824 __field(unsigned long long, boot_time) 825 __field(u32, xid) 826 __field(u32, cached) 827 __field(u32, ingress) 828 ), 829 TP_fast_assign( 830 __entry->boot_time = nn->boot_time; 831 __entry->xid = be32_to_cpu(key->c_key.k_xid); 832 __entry->cached = (__force u32)key->c_key.k_csum; 833 __entry->ingress = (__force u32)rp->c_key.k_csum; 834 ), 835 TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x", 836 __entry->boot_time, __entry->xid, __entry->cached, 837 __entry->ingress) 838 ); 839 840 TRACE_EVENT(nfsd_cb_args, 841 TP_PROTO( 842 const struct nfs4_client *clp, 843 const struct nfs4_cb_conn *conn 844 ), 845 TP_ARGS(clp, conn), 846 TP_STRUCT__entry( 847 __field(u32, cl_boot) 848 __field(u32, cl_id) 849 __field(u32, prog) 850 __field(u32, ident) 851 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 852 ), 853 TP_fast_assign( 854 __entry->cl_boot = clp->cl_clientid.cl_boot; 855 __entry->cl_id = clp->cl_clientid.cl_id; 856 __entry->prog = conn->cb_prog; 857 __entry->ident = conn->cb_ident; 858 memcpy(__entry->addr, &conn->cb_addr, 859 sizeof(struct sockaddr_in6)); 860 ), 861 TP_printk("client %08x:%08x callback addr=%pISpc prog=%u ident=%u", 862 __entry->cl_boot, __entry->cl_id, 863 __entry->addr, __entry->prog, __entry->ident) 864 ); 865 866 TRACE_EVENT(nfsd_cb_nodelegs, 867 TP_PROTO(const struct nfs4_client *clp), 868 TP_ARGS(clp), 869 TP_STRUCT__entry( 870 __field(u32, cl_boot) 871 __field(u32, cl_id) 872 ), 873 TP_fast_assign( 874 __entry->cl_boot = clp->cl_clientid.cl_boot; 875 __entry->cl_id = clp->cl_clientid.cl_id; 876 ), 877 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 878 ) 879 880 #define show_cb_state(val) \ 881 __print_symbolic(val, \ 882 { NFSD4_CB_UP, "UP" }, \ 883 { NFSD4_CB_UNKNOWN, "UNKNOWN" }, \ 884 { NFSD4_CB_DOWN, "DOWN" }, \ 885 { NFSD4_CB_FAULT, "FAULT"}) 886 887 DECLARE_EVENT_CLASS(nfsd_cb_class, 888 TP_PROTO(const struct nfs4_client *clp), 889 TP_ARGS(clp), 890 TP_STRUCT__entry( 891 __field(unsigned long, state) 892 __field(u32, cl_boot) 893 __field(u32, cl_id) 894 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 895 ), 896 TP_fast_assign( 897 __entry->state = clp->cl_cb_state; 898 __entry->cl_boot = clp->cl_clientid.cl_boot; 899 __entry->cl_id = clp->cl_clientid.cl_id; 900 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 901 sizeof(struct sockaddr_in6)); 902 ), 903 TP_printk("addr=%pISpc client %08x:%08x state=%s", 904 __entry->addr, __entry->cl_boot, __entry->cl_id, 905 show_cb_state(__entry->state)) 906 ); 907 908 #define DEFINE_NFSD_CB_EVENT(name) \ 909 DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name, \ 910 TP_PROTO(const struct nfs4_client *clp), \ 911 TP_ARGS(clp)) 912 913 DEFINE_NFSD_CB_EVENT(state); 914 DEFINE_NFSD_CB_EVENT(lost); 915 DEFINE_NFSD_CB_EVENT(shutdown); 916 917 TRACE_DEFINE_ENUM(RPC_AUTH_NULL); 918 TRACE_DEFINE_ENUM(RPC_AUTH_UNIX); 919 TRACE_DEFINE_ENUM(RPC_AUTH_GSS); 920 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 921 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 922 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 923 924 #define show_nfsd_authflavor(val) \ 925 __print_symbolic(val, \ 926 { RPC_AUTH_NULL, "none" }, \ 927 { RPC_AUTH_UNIX, "sys" }, \ 928 { RPC_AUTH_GSS, "gss" }, \ 929 { RPC_AUTH_GSS_KRB5, "krb5" }, \ 930 { RPC_AUTH_GSS_KRB5I, "krb5i" }, \ 931 { RPC_AUTH_GSS_KRB5P, "krb5p" }) 932 933 TRACE_EVENT(nfsd_cb_setup, 934 TP_PROTO(const struct nfs4_client *clp, 935 const char *netid, 936 rpc_authflavor_t authflavor 937 ), 938 TP_ARGS(clp, netid, authflavor), 939 TP_STRUCT__entry( 940 __field(u32, cl_boot) 941 __field(u32, cl_id) 942 __field(unsigned long, authflavor) 943 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 944 __array(unsigned char, netid, 8) 945 ), 946 TP_fast_assign( 947 __entry->cl_boot = clp->cl_clientid.cl_boot; 948 __entry->cl_id = clp->cl_clientid.cl_id; 949 strlcpy(__entry->netid, netid, sizeof(__entry->netid)); 950 __entry->authflavor = authflavor; 951 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 952 sizeof(struct sockaddr_in6)); 953 ), 954 TP_printk("addr=%pISpc client %08x:%08x proto=%s flavor=%s", 955 __entry->addr, __entry->cl_boot, __entry->cl_id, 956 __entry->netid, show_nfsd_authflavor(__entry->authflavor)) 957 ); 958 959 TRACE_EVENT(nfsd_cb_setup_err, 960 TP_PROTO( 961 const struct nfs4_client *clp, 962 long error 963 ), 964 TP_ARGS(clp, error), 965 TP_STRUCT__entry( 966 __field(long, error) 967 __field(u32, cl_boot) 968 __field(u32, cl_id) 969 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 970 ), 971 TP_fast_assign( 972 __entry->error = error; 973 __entry->cl_boot = clp->cl_clientid.cl_boot; 974 __entry->cl_id = clp->cl_clientid.cl_id; 975 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 976 sizeof(struct sockaddr_in6)); 977 ), 978 TP_printk("addr=%pISpc client %08x:%08x error=%ld", 979 __entry->addr, __entry->cl_boot, __entry->cl_id, __entry->error) 980 ); 981 982 TRACE_EVENT(nfsd_cb_work, 983 TP_PROTO( 984 const struct nfs4_client *clp, 985 const char *procedure 986 ), 987 TP_ARGS(clp, procedure), 988 TP_STRUCT__entry( 989 __field(u32, cl_boot) 990 __field(u32, cl_id) 991 __string(procedure, procedure) 992 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 993 ), 994 TP_fast_assign( 995 __entry->cl_boot = clp->cl_clientid.cl_boot; 996 __entry->cl_id = clp->cl_clientid.cl_id; 997 __assign_str(procedure, procedure) 998 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 999 sizeof(struct sockaddr_in6)); 1000 ), 1001 TP_printk("addr=%pISpc client %08x:%08x procedure=%s", 1002 __entry->addr, __entry->cl_boot, __entry->cl_id, 1003 __get_str(procedure)) 1004 ); 1005 1006 TRACE_EVENT(nfsd_cb_done, 1007 TP_PROTO( 1008 const struct nfs4_client *clp, 1009 int status 1010 ), 1011 TP_ARGS(clp, status), 1012 TP_STRUCT__entry( 1013 __field(u32, cl_boot) 1014 __field(u32, cl_id) 1015 __field(int, status) 1016 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 1017 ), 1018 TP_fast_assign( 1019 __entry->cl_boot = clp->cl_clientid.cl_boot; 1020 __entry->cl_id = clp->cl_clientid.cl_id; 1021 __entry->status = status; 1022 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 1023 sizeof(struct sockaddr_in6)); 1024 ), 1025 TP_printk("addr=%pISpc client %08x:%08x status=%d", 1026 __entry->addr, __entry->cl_boot, __entry->cl_id, 1027 __entry->status) 1028 ); 1029 1030 TRACE_EVENT(nfsd_cb_notify_lock, 1031 TP_PROTO( 1032 const struct nfs4_lockowner *lo, 1033 const struct nfsd4_blocked_lock *nbl 1034 ), 1035 TP_ARGS(lo, nbl), 1036 TP_STRUCT__entry( 1037 __field(u32, cl_boot) 1038 __field(u32, cl_id) 1039 __field(u32, fh_hash) 1040 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 1041 ), 1042 TP_fast_assign( 1043 const struct nfs4_client *clp = lo->lo_owner.so_client; 1044 1045 __entry->cl_boot = clp->cl_clientid.cl_boot; 1046 __entry->cl_id = clp->cl_clientid.cl_id; 1047 __entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh); 1048 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 1049 sizeof(struct sockaddr_in6)); 1050 ), 1051 TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x", 1052 __entry->addr, __entry->cl_boot, __entry->cl_id, 1053 __entry->fh_hash) 1054 ); 1055 1056 #endif /* _NFSD_TRACE_H */ 1057 1058 #undef TRACE_INCLUDE_PATH 1059 #define TRACE_INCLUDE_PATH . 1060 #define TRACE_INCLUDE_FILE trace 1061 #include <trace/define_trace.h> 1062