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(expired); 515 DEFINE_CLIENTID_EVENT(purged); 516 DEFINE_CLIENTID_EVENT(renew); 517 DEFINE_CLIENTID_EVENT(stale); 518 519 DECLARE_EVENT_CLASS(nfsd_net_class, 520 TP_PROTO(const struct nfsd_net *nn), 521 TP_ARGS(nn), 522 TP_STRUCT__entry( 523 __field(unsigned long long, boot_time) 524 ), 525 TP_fast_assign( 526 __entry->boot_time = nn->boot_time; 527 ), 528 TP_printk("boot_time=%16llx", __entry->boot_time) 529 ) 530 531 #define DEFINE_NET_EVENT(name) \ 532 DEFINE_EVENT(nfsd_net_class, nfsd_##name, \ 533 TP_PROTO(const struct nfsd_net *nn), \ 534 TP_ARGS(nn)) 535 536 DEFINE_NET_EVENT(grace_start); 537 DEFINE_NET_EVENT(grace_complete); 538 539 DECLARE_EVENT_CLASS(nfsd_clid_class, 540 TP_PROTO(const struct nfsd_net *nn, 541 unsigned int namelen, 542 const unsigned char *namedata), 543 TP_ARGS(nn, namelen, namedata), 544 TP_STRUCT__entry( 545 __field(unsigned long long, boot_time) 546 __field(unsigned int, namelen) 547 __dynamic_array(unsigned char, name, namelen) 548 ), 549 TP_fast_assign( 550 __entry->boot_time = nn->boot_time; 551 __entry->namelen = namelen; 552 memcpy(__get_dynamic_array(name), namedata, namelen); 553 ), 554 TP_printk("boot_time=%16llx nfs4_clientid=%.*s", 555 __entry->boot_time, __entry->namelen, __get_str(name)) 556 ) 557 558 #define DEFINE_CLID_EVENT(name) \ 559 DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \ 560 TP_PROTO(const struct nfsd_net *nn, \ 561 unsigned int namelen, \ 562 const unsigned char *namedata), \ 563 TP_ARGS(nn, namelen, namedata)) 564 565 DEFINE_CLID_EVENT(find); 566 DEFINE_CLID_EVENT(reclaim); 567 568 TRACE_EVENT(nfsd_clid_inuse_err, 569 TP_PROTO(const struct nfs4_client *clp), 570 TP_ARGS(clp), 571 TP_STRUCT__entry( 572 __field(u32, cl_boot) 573 __field(u32, cl_id) 574 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 575 __field(unsigned int, namelen) 576 __dynamic_array(unsigned char, name, clp->cl_name.len) 577 ), 578 TP_fast_assign( 579 __entry->cl_boot = clp->cl_clientid.cl_boot; 580 __entry->cl_id = clp->cl_clientid.cl_id; 581 memcpy(__entry->addr, &clp->cl_addr, 582 sizeof(struct sockaddr_in6)); 583 __entry->namelen = clp->cl_name.len; 584 memcpy(__get_dynamic_array(name), clp->cl_name.data, 585 clp->cl_name.len); 586 ), 587 TP_printk("nfs4_clientid %.*s already in use by %pISpc, client %08x:%08x", 588 __entry->namelen, __get_str(name), __entry->addr, 589 __entry->cl_boot, __entry->cl_id) 590 ) 591 592 /* 593 * from fs/nfsd/filecache.h 594 */ 595 TRACE_DEFINE_ENUM(NFSD_FILE_HASHED); 596 TRACE_DEFINE_ENUM(NFSD_FILE_PENDING); 597 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ); 598 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE); 599 TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED); 600 601 #define show_nf_flags(val) \ 602 __print_flags(val, "|", \ 603 { 1 << NFSD_FILE_HASHED, "HASHED" }, \ 604 { 1 << NFSD_FILE_PENDING, "PENDING" }, \ 605 { 1 << NFSD_FILE_BREAK_READ, "BREAK_READ" }, \ 606 { 1 << NFSD_FILE_BREAK_WRITE, "BREAK_WRITE" }, \ 607 { 1 << NFSD_FILE_REFERENCED, "REFERENCED"}) 608 609 DECLARE_EVENT_CLASS(nfsd_file_class, 610 TP_PROTO(struct nfsd_file *nf), 611 TP_ARGS(nf), 612 TP_STRUCT__entry( 613 __field(unsigned int, nf_hashval) 614 __field(void *, nf_inode) 615 __field(int, nf_ref) 616 __field(unsigned long, nf_flags) 617 __field(unsigned char, nf_may) 618 __field(struct file *, nf_file) 619 ), 620 TP_fast_assign( 621 __entry->nf_hashval = nf->nf_hashval; 622 __entry->nf_inode = nf->nf_inode; 623 __entry->nf_ref = refcount_read(&nf->nf_ref); 624 __entry->nf_flags = nf->nf_flags; 625 __entry->nf_may = nf->nf_may; 626 __entry->nf_file = nf->nf_file; 627 ), 628 TP_printk("hash=0x%x inode=%p ref=%d flags=%s may=%s file=%p", 629 __entry->nf_hashval, 630 __entry->nf_inode, 631 __entry->nf_ref, 632 show_nf_flags(__entry->nf_flags), 633 show_nfsd_may_flags(__entry->nf_may), 634 __entry->nf_file) 635 ) 636 637 #define DEFINE_NFSD_FILE_EVENT(name) \ 638 DEFINE_EVENT(nfsd_file_class, name, \ 639 TP_PROTO(struct nfsd_file *nf), \ 640 TP_ARGS(nf)) 641 642 DEFINE_NFSD_FILE_EVENT(nfsd_file_alloc); 643 DEFINE_NFSD_FILE_EVENT(nfsd_file_put_final); 644 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash); 645 DEFINE_NFSD_FILE_EVENT(nfsd_file_put); 646 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_release_locked); 647 648 TRACE_EVENT(nfsd_file_acquire, 649 TP_PROTO(struct svc_rqst *rqstp, unsigned int hash, 650 struct inode *inode, unsigned int may_flags, 651 struct nfsd_file *nf, __be32 status), 652 653 TP_ARGS(rqstp, hash, inode, may_flags, nf, status), 654 655 TP_STRUCT__entry( 656 __field(u32, xid) 657 __field(unsigned int, hash) 658 __field(void *, inode) 659 __field(unsigned long, may_flags) 660 __field(int, nf_ref) 661 __field(unsigned long, nf_flags) 662 __field(unsigned long, nf_may) 663 __field(struct file *, nf_file) 664 __field(u32, status) 665 ), 666 667 TP_fast_assign( 668 __entry->xid = be32_to_cpu(rqstp->rq_xid); 669 __entry->hash = hash; 670 __entry->inode = inode; 671 __entry->may_flags = may_flags; 672 __entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0; 673 __entry->nf_flags = nf ? nf->nf_flags : 0; 674 __entry->nf_may = nf ? nf->nf_may : 0; 675 __entry->nf_file = nf ? nf->nf_file : NULL; 676 __entry->status = be32_to_cpu(status); 677 ), 678 679 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", 680 __entry->xid, __entry->hash, __entry->inode, 681 show_nfsd_may_flags(__entry->may_flags), 682 __entry->nf_ref, show_nf_flags(__entry->nf_flags), 683 show_nfsd_may_flags(__entry->nf_may), 684 __entry->nf_file, __entry->status) 685 ); 686 687 DECLARE_EVENT_CLASS(nfsd_file_search_class, 688 TP_PROTO(struct inode *inode, unsigned int hash, int found), 689 TP_ARGS(inode, hash, found), 690 TP_STRUCT__entry( 691 __field(struct inode *, inode) 692 __field(unsigned int, hash) 693 __field(int, found) 694 ), 695 TP_fast_assign( 696 __entry->inode = inode; 697 __entry->hash = hash; 698 __entry->found = found; 699 ), 700 TP_printk("hash=0x%x inode=%p found=%d", __entry->hash, 701 __entry->inode, __entry->found) 702 ); 703 704 #define DEFINE_NFSD_FILE_SEARCH_EVENT(name) \ 705 DEFINE_EVENT(nfsd_file_search_class, name, \ 706 TP_PROTO(struct inode *inode, unsigned int hash, int found), \ 707 TP_ARGS(inode, hash, found)) 708 709 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync); 710 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode); 711 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_is_cached); 712 713 TRACE_EVENT(nfsd_file_fsnotify_handle_event, 714 TP_PROTO(struct inode *inode, u32 mask), 715 TP_ARGS(inode, mask), 716 TP_STRUCT__entry( 717 __field(struct inode *, inode) 718 __field(unsigned int, nlink) 719 __field(umode_t, mode) 720 __field(u32, mask) 721 ), 722 TP_fast_assign( 723 __entry->inode = inode; 724 __entry->nlink = inode->i_nlink; 725 __entry->mode = inode->i_mode; 726 __entry->mask = mask; 727 ), 728 TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode, 729 __entry->nlink, __entry->mode, __entry->mask) 730 ); 731 732 #include "cache.h" 733 734 TRACE_DEFINE_ENUM(RC_DROPIT); 735 TRACE_DEFINE_ENUM(RC_REPLY); 736 TRACE_DEFINE_ENUM(RC_DOIT); 737 738 #define show_drc_retval(x) \ 739 __print_symbolic(x, \ 740 { RC_DROPIT, "DROPIT" }, \ 741 { RC_REPLY, "REPLY" }, \ 742 { RC_DOIT, "DOIT" }) 743 744 TRACE_EVENT(nfsd_drc_found, 745 TP_PROTO( 746 const struct nfsd_net *nn, 747 const struct svc_rqst *rqstp, 748 int result 749 ), 750 TP_ARGS(nn, rqstp, result), 751 TP_STRUCT__entry( 752 __field(unsigned long long, boot_time) 753 __field(unsigned long, result) 754 __field(u32, xid) 755 ), 756 TP_fast_assign( 757 __entry->boot_time = nn->boot_time; 758 __entry->result = result; 759 __entry->xid = be32_to_cpu(rqstp->rq_xid); 760 ), 761 TP_printk("boot_time=%16llx xid=0x%08x result=%s", 762 __entry->boot_time, __entry->xid, 763 show_drc_retval(__entry->result)) 764 765 ); 766 767 TRACE_EVENT(nfsd_drc_mismatch, 768 TP_PROTO( 769 const struct nfsd_net *nn, 770 const struct svc_cacherep *key, 771 const struct svc_cacherep *rp 772 ), 773 TP_ARGS(nn, key, rp), 774 TP_STRUCT__entry( 775 __field(unsigned long long, boot_time) 776 __field(u32, xid) 777 __field(u32, cached) 778 __field(u32, ingress) 779 ), 780 TP_fast_assign( 781 __entry->boot_time = nn->boot_time; 782 __entry->xid = be32_to_cpu(key->c_key.k_xid); 783 __entry->cached = (__force u32)key->c_key.k_csum; 784 __entry->ingress = (__force u32)rp->c_key.k_csum; 785 ), 786 TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x", 787 __entry->boot_time, __entry->xid, __entry->cached, 788 __entry->ingress) 789 ); 790 791 TRACE_EVENT(nfsd_cb_args, 792 TP_PROTO( 793 const struct nfs4_client *clp, 794 const struct nfs4_cb_conn *conn 795 ), 796 TP_ARGS(clp, conn), 797 TP_STRUCT__entry( 798 __field(u32, cl_boot) 799 __field(u32, cl_id) 800 __field(u32, prog) 801 __field(u32, ident) 802 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 803 ), 804 TP_fast_assign( 805 __entry->cl_boot = clp->cl_clientid.cl_boot; 806 __entry->cl_id = clp->cl_clientid.cl_id; 807 __entry->prog = conn->cb_prog; 808 __entry->ident = conn->cb_ident; 809 memcpy(__entry->addr, &conn->cb_addr, 810 sizeof(struct sockaddr_in6)); 811 ), 812 TP_printk("client %08x:%08x callback addr=%pISpc prog=%u ident=%u", 813 __entry->cl_boot, __entry->cl_id, 814 __entry->addr, __entry->prog, __entry->ident) 815 ); 816 817 TRACE_EVENT(nfsd_cb_nodelegs, 818 TP_PROTO(const struct nfs4_client *clp), 819 TP_ARGS(clp), 820 TP_STRUCT__entry( 821 __field(u32, cl_boot) 822 __field(u32, cl_id) 823 ), 824 TP_fast_assign( 825 __entry->cl_boot = clp->cl_clientid.cl_boot; 826 __entry->cl_id = clp->cl_clientid.cl_id; 827 ), 828 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 829 ) 830 831 TRACE_DEFINE_ENUM(NFSD4_CB_UP); 832 TRACE_DEFINE_ENUM(NFSD4_CB_UNKNOWN); 833 TRACE_DEFINE_ENUM(NFSD4_CB_DOWN); 834 TRACE_DEFINE_ENUM(NFSD4_CB_FAULT); 835 836 #define show_cb_state(val) \ 837 __print_symbolic(val, \ 838 { NFSD4_CB_UP, "UP" }, \ 839 { NFSD4_CB_UNKNOWN, "UNKNOWN" }, \ 840 { NFSD4_CB_DOWN, "DOWN" }, \ 841 { NFSD4_CB_FAULT, "FAULT"}) 842 843 DECLARE_EVENT_CLASS(nfsd_cb_class, 844 TP_PROTO(const struct nfs4_client *clp), 845 TP_ARGS(clp), 846 TP_STRUCT__entry( 847 __field(unsigned long, state) 848 __field(u32, cl_boot) 849 __field(u32, cl_id) 850 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 851 ), 852 TP_fast_assign( 853 __entry->state = clp->cl_cb_state; 854 __entry->cl_boot = clp->cl_clientid.cl_boot; 855 __entry->cl_id = clp->cl_clientid.cl_id; 856 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 857 sizeof(struct sockaddr_in6)); 858 ), 859 TP_printk("addr=%pISpc client %08x:%08x state=%s", 860 __entry->addr, __entry->cl_boot, __entry->cl_id, 861 show_cb_state(__entry->state)) 862 ); 863 864 #define DEFINE_NFSD_CB_EVENT(name) \ 865 DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name, \ 866 TP_PROTO(const struct nfs4_client *clp), \ 867 TP_ARGS(clp)) 868 869 DEFINE_NFSD_CB_EVENT(setup); 870 DEFINE_NFSD_CB_EVENT(state); 871 DEFINE_NFSD_CB_EVENT(shutdown); 872 873 TRACE_EVENT(nfsd_cb_setup_err, 874 TP_PROTO( 875 const struct nfs4_client *clp, 876 long error 877 ), 878 TP_ARGS(clp, error), 879 TP_STRUCT__entry( 880 __field(long, error) 881 __field(u32, cl_boot) 882 __field(u32, cl_id) 883 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 884 ), 885 TP_fast_assign( 886 __entry->error = error; 887 __entry->cl_boot = clp->cl_clientid.cl_boot; 888 __entry->cl_id = clp->cl_clientid.cl_id; 889 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 890 sizeof(struct sockaddr_in6)); 891 ), 892 TP_printk("addr=%pISpc client %08x:%08x error=%ld", 893 __entry->addr, __entry->cl_boot, __entry->cl_id, __entry->error) 894 ); 895 896 TRACE_EVENT(nfsd_cb_work, 897 TP_PROTO( 898 const struct nfs4_client *clp, 899 const char *procedure 900 ), 901 TP_ARGS(clp, procedure), 902 TP_STRUCT__entry( 903 __field(u32, cl_boot) 904 __field(u32, cl_id) 905 __string(procedure, procedure) 906 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 907 ), 908 TP_fast_assign( 909 __entry->cl_boot = clp->cl_clientid.cl_boot; 910 __entry->cl_id = clp->cl_clientid.cl_id; 911 __assign_str(procedure, procedure) 912 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 913 sizeof(struct sockaddr_in6)); 914 ), 915 TP_printk("addr=%pISpc client %08x:%08x procedure=%s", 916 __entry->addr, __entry->cl_boot, __entry->cl_id, 917 __get_str(procedure)) 918 ); 919 920 TRACE_EVENT(nfsd_cb_done, 921 TP_PROTO( 922 const struct nfs4_client *clp, 923 int status 924 ), 925 TP_ARGS(clp, status), 926 TP_STRUCT__entry( 927 __field(u32, cl_boot) 928 __field(u32, cl_id) 929 __field(int, status) 930 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 931 ), 932 TP_fast_assign( 933 __entry->cl_boot = clp->cl_clientid.cl_boot; 934 __entry->cl_id = clp->cl_clientid.cl_id; 935 __entry->status = status; 936 memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr, 937 sizeof(struct sockaddr_in6)); 938 ), 939 TP_printk("addr=%pISpc client %08x:%08x status=%d", 940 __entry->addr, __entry->cl_boot, __entry->cl_id, 941 __entry->status) 942 ); 943 944 #endif /* _NFSD_TRACE_H */ 945 946 #undef TRACE_INCLUDE_PATH 947 #define TRACE_INCLUDE_PATH . 948 #define TRACE_INCLUDE_FILE trace 949 #include <trace/define_trace.h> 950