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 <linux/sunrpc/clnt.h> 13 #include <linux/sunrpc/xprt.h> 14 #include <trace/misc/nfs.h> 15 #include <trace/misc/sunrpc.h> 16 17 #include "export.h" 18 #include "nfsfh.h" 19 #include "xdr4.h" 20 21 #define NFSD_TRACE_PROC_RES_FIELDS \ 22 __field(unsigned int, netns_ino) \ 23 __field(u32, xid) \ 24 __field(unsigned long, status) \ 25 __array(unsigned char, server, sizeof(struct sockaddr_in6)) \ 26 __array(unsigned char, client, sizeof(struct sockaddr_in6)) 27 28 #define NFSD_TRACE_PROC_RES_ASSIGNMENTS(error) \ 29 do { \ 30 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; \ 31 __entry->xid = be32_to_cpu(rqstp->rq_xid); \ 32 __entry->status = be32_to_cpu(error); \ 33 memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \ 34 rqstp->rq_xprt->xpt_locallen); \ 35 memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \ 36 rqstp->rq_xprt->xpt_remotelen); \ 37 } while (0); 38 39 DECLARE_EVENT_CLASS(nfsd_xdr_err_class, 40 TP_PROTO( 41 const struct svc_rqst *rqstp 42 ), 43 TP_ARGS(rqstp), 44 TP_STRUCT__entry( 45 __field(unsigned int, netns_ino) 46 __field(u32, xid) 47 __field(u32, vers) 48 __field(u32, proc) 49 __sockaddr(server, rqstp->rq_xprt->xpt_locallen) 50 __sockaddr(client, rqstp->rq_xprt->xpt_remotelen) 51 ), 52 TP_fast_assign( 53 const struct svc_xprt *xprt = rqstp->rq_xprt; 54 55 __entry->netns_ino = xprt->xpt_net->ns.inum; 56 __entry->xid = be32_to_cpu(rqstp->rq_xid); 57 __entry->vers = rqstp->rq_vers; 58 __entry->proc = rqstp->rq_proc; 59 __assign_sockaddr(server, &xprt->xpt_local, xprt->xpt_locallen); 60 __assign_sockaddr(client, &xprt->xpt_remote, xprt->xpt_remotelen); 61 ), 62 TP_printk("xid=0x%08x vers=%u proc=%u", 63 __entry->xid, __entry->vers, __entry->proc 64 ) 65 ); 66 67 #define DEFINE_NFSD_XDR_ERR_EVENT(name) \ 68 DEFINE_EVENT(nfsd_xdr_err_class, nfsd_##name##_err, \ 69 TP_PROTO(const struct svc_rqst *rqstp), \ 70 TP_ARGS(rqstp)) 71 72 DEFINE_NFSD_XDR_ERR_EVENT(garbage_args); 73 DEFINE_NFSD_XDR_ERR_EVENT(cant_encode); 74 75 #define show_nfsd_may_flags(x) \ 76 __print_flags(x, "|", \ 77 { NFSD_MAY_EXEC, "EXEC" }, \ 78 { NFSD_MAY_WRITE, "WRITE" }, \ 79 { NFSD_MAY_READ, "READ" }, \ 80 { NFSD_MAY_SATTR, "SATTR" }, \ 81 { NFSD_MAY_TRUNC, "TRUNC" }, \ 82 { NFSD_MAY_LOCK, "LOCK" }, \ 83 { NFSD_MAY_OWNER_OVERRIDE, "OWNER_OVERRIDE" }, \ 84 { NFSD_MAY_LOCAL_ACCESS, "LOCAL_ACCESS" }, \ 85 { NFSD_MAY_BYPASS_GSS_ON_ROOT, "BYPASS_GSS_ON_ROOT" }, \ 86 { NFSD_MAY_NOT_BREAK_LEASE, "NOT_BREAK_LEASE" }, \ 87 { NFSD_MAY_BYPASS_GSS, "BYPASS_GSS" }, \ 88 { NFSD_MAY_READ_IF_EXEC, "READ_IF_EXEC" }, \ 89 { NFSD_MAY_64BIT_COOKIE, "64BIT_COOKIE" }) 90 91 TRACE_EVENT(nfsd_compound, 92 TP_PROTO( 93 const struct svc_rqst *rqst, 94 const char *tag, 95 u32 taglen, 96 u32 opcnt 97 ), 98 TP_ARGS(rqst, tag, taglen, opcnt), 99 TP_STRUCT__entry( 100 __field(u32, xid) 101 __field(u32, opcnt) 102 __string_len(tag, tag, taglen) 103 ), 104 TP_fast_assign( 105 __entry->xid = be32_to_cpu(rqst->rq_xid); 106 __entry->opcnt = opcnt; 107 __assign_str(tag); 108 ), 109 TP_printk("xid=0x%08x opcnt=%u tag=%s", 110 __entry->xid, __entry->opcnt, __get_str(tag) 111 ) 112 ) 113 114 TRACE_EVENT(nfsd_compound_status, 115 TP_PROTO(u32 args_opcnt, 116 u32 resp_opcnt, 117 __be32 status, 118 const char *name), 119 TP_ARGS(args_opcnt, resp_opcnt, status, name), 120 TP_STRUCT__entry( 121 __field(u32, args_opcnt) 122 __field(u32, resp_opcnt) 123 __field(int, status) 124 __string(name, name) 125 ), 126 TP_fast_assign( 127 __entry->args_opcnt = args_opcnt; 128 __entry->resp_opcnt = resp_opcnt; 129 __entry->status = be32_to_cpu(status); 130 __assign_str(name); 131 ), 132 TP_printk("op=%u/%u %s status=%d", 133 __entry->resp_opcnt, __entry->args_opcnt, 134 __get_str(name), __entry->status) 135 ) 136 137 TRACE_EVENT(nfsd_compound_decode_err, 138 TP_PROTO( 139 const struct svc_rqst *rqstp, 140 u32 args_opcnt, 141 u32 resp_opcnt, 142 u32 opnum, 143 __be32 status 144 ), 145 TP_ARGS(rqstp, args_opcnt, resp_opcnt, opnum, status), 146 TP_STRUCT__entry( 147 NFSD_TRACE_PROC_RES_FIELDS 148 149 __field(u32, args_opcnt) 150 __field(u32, resp_opcnt) 151 __field(u32, opnum) 152 ), 153 TP_fast_assign( 154 NFSD_TRACE_PROC_RES_ASSIGNMENTS(status) 155 156 __entry->args_opcnt = args_opcnt; 157 __entry->resp_opcnt = resp_opcnt; 158 __entry->opnum = opnum; 159 ), 160 TP_printk("op=%u/%u opnum=%u status=%lu", 161 __entry->resp_opcnt, __entry->args_opcnt, 162 __entry->opnum, __entry->status) 163 ); 164 165 TRACE_EVENT(nfsd_compound_encode_err, 166 TP_PROTO( 167 const struct svc_rqst *rqstp, 168 u32 opnum, 169 __be32 status 170 ), 171 TP_ARGS(rqstp, opnum, status), 172 TP_STRUCT__entry( 173 NFSD_TRACE_PROC_RES_FIELDS 174 175 __field(u32, opnum) 176 ), 177 TP_fast_assign( 178 NFSD_TRACE_PROC_RES_ASSIGNMENTS(status) 179 180 __entry->opnum = opnum; 181 ), 182 TP_printk("opnum=%u status=%lu", 183 __entry->opnum, __entry->status) 184 ); 185 186 #define show_fs_file_type(x) \ 187 __print_symbolic(x, \ 188 { S_IFLNK, "LNK" }, \ 189 { S_IFREG, "REG" }, \ 190 { S_IFDIR, "DIR" }, \ 191 { S_IFCHR, "CHR" }, \ 192 { S_IFBLK, "BLK" }, \ 193 { S_IFIFO, "FIFO" }, \ 194 { S_IFSOCK, "SOCK" }) 195 196 TRACE_EVENT(nfsd_fh_verify, 197 TP_PROTO( 198 const struct svc_rqst *rqstp, 199 const struct svc_fh *fhp, 200 umode_t type, 201 int access 202 ), 203 TP_ARGS(rqstp, fhp, type, access), 204 TP_STRUCT__entry( 205 __field(unsigned int, netns_ino) 206 __sockaddr(server, rqstp->rq_xprt->xpt_remotelen) 207 __sockaddr(client, rqstp->rq_xprt->xpt_remotelen) 208 __field(u32, xid) 209 __field(u32, fh_hash) 210 __field(const void *, inode) 211 __field(unsigned long, type) 212 __field(unsigned long, access) 213 ), 214 TP_fast_assign( 215 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; 216 __assign_sockaddr(server, &rqstp->rq_xprt->xpt_local, 217 rqstp->rq_xprt->xpt_locallen); 218 __assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote, 219 rqstp->rq_xprt->xpt_remotelen); 220 __entry->xid = be32_to_cpu(rqstp->rq_xid); 221 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 222 __entry->inode = d_inode(fhp->fh_dentry); 223 __entry->type = type; 224 __entry->access = access; 225 ), 226 TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s", 227 __entry->xid, __entry->fh_hash, 228 show_fs_file_type(__entry->type), 229 show_nfsd_may_flags(__entry->access) 230 ) 231 ); 232 233 TRACE_EVENT_CONDITION(nfsd_fh_verify_err, 234 TP_PROTO( 235 const struct svc_rqst *rqstp, 236 const struct svc_fh *fhp, 237 umode_t type, 238 int access, 239 __be32 error 240 ), 241 TP_ARGS(rqstp, fhp, type, access, error), 242 TP_CONDITION(error), 243 TP_STRUCT__entry( 244 __field(unsigned int, netns_ino) 245 __sockaddr(server, rqstp->rq_xprt->xpt_remotelen) 246 __sockaddr(client, rqstp->rq_xprt->xpt_remotelen) 247 __field(u32, xid) 248 __field(u32, fh_hash) 249 __field(const void *, inode) 250 __field(unsigned long, type) 251 __field(unsigned long, access) 252 __field(int, error) 253 ), 254 TP_fast_assign( 255 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; 256 __assign_sockaddr(server, &rqstp->rq_xprt->xpt_local, 257 rqstp->rq_xprt->xpt_locallen); 258 __assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote, 259 rqstp->rq_xprt->xpt_remotelen); 260 __entry->xid = be32_to_cpu(rqstp->rq_xid); 261 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 262 if (fhp->fh_dentry) 263 __entry->inode = d_inode(fhp->fh_dentry); 264 else 265 __entry->inode = NULL; 266 __entry->type = type; 267 __entry->access = access; 268 __entry->error = be32_to_cpu(error); 269 ), 270 TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s error=%d", 271 __entry->xid, __entry->fh_hash, 272 show_fs_file_type(__entry->type), 273 show_nfsd_may_flags(__entry->access), 274 __entry->error 275 ) 276 ); 277 278 DECLARE_EVENT_CLASS(nfsd_fh_err_class, 279 TP_PROTO(struct svc_rqst *rqstp, 280 struct svc_fh *fhp, 281 int status), 282 TP_ARGS(rqstp, fhp, status), 283 TP_STRUCT__entry( 284 __field(u32, xid) 285 __field(u32, fh_hash) 286 __field(int, status) 287 ), 288 TP_fast_assign( 289 __entry->xid = be32_to_cpu(rqstp->rq_xid); 290 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 291 __entry->status = status; 292 ), 293 TP_printk("xid=0x%08x fh_hash=0x%08x status=%d", 294 __entry->xid, __entry->fh_hash, 295 __entry->status) 296 ) 297 298 #define DEFINE_NFSD_FH_ERR_EVENT(name) \ 299 DEFINE_EVENT(nfsd_fh_err_class, nfsd_##name, \ 300 TP_PROTO(struct svc_rqst *rqstp, \ 301 struct svc_fh *fhp, \ 302 int status), \ 303 TP_ARGS(rqstp, fhp, status)) 304 305 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport); 306 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle); 307 308 TRACE_EVENT(nfsd_exp_find_key, 309 TP_PROTO(const struct svc_expkey *key, 310 int status), 311 TP_ARGS(key, status), 312 TP_STRUCT__entry( 313 __field(int, fsidtype) 314 __array(u32, fsid, 6) 315 __string(auth_domain, key->ek_client->name) 316 __field(int, status) 317 ), 318 TP_fast_assign( 319 __entry->fsidtype = key->ek_fsidtype; 320 memcpy(__entry->fsid, key->ek_fsid, 4*6); 321 __assign_str(auth_domain); 322 __entry->status = status; 323 ), 324 TP_printk("fsid=%x::%s domain=%s status=%d", 325 __entry->fsidtype, 326 __print_array(__entry->fsid, 6, 4), 327 __get_str(auth_domain), 328 __entry->status 329 ) 330 ); 331 332 TRACE_EVENT(nfsd_expkey_update, 333 TP_PROTO(const struct svc_expkey *key, const char *exp_path), 334 TP_ARGS(key, exp_path), 335 TP_STRUCT__entry( 336 __field(int, fsidtype) 337 __array(u32, fsid, 6) 338 __string(auth_domain, key->ek_client->name) 339 __string(path, exp_path) 340 __field(bool, cache) 341 ), 342 TP_fast_assign( 343 __entry->fsidtype = key->ek_fsidtype; 344 memcpy(__entry->fsid, key->ek_fsid, 4*6); 345 __assign_str(auth_domain); 346 __assign_str(path); 347 __entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags); 348 ), 349 TP_printk("fsid=%x::%s domain=%s path=%s cache=%s", 350 __entry->fsidtype, 351 __print_array(__entry->fsid, 6, 4), 352 __get_str(auth_domain), 353 __get_str(path), 354 __entry->cache ? "pos" : "neg" 355 ) 356 ); 357 358 TRACE_EVENT(nfsd_exp_get_by_name, 359 TP_PROTO(const struct svc_export *key, 360 int status), 361 TP_ARGS(key, status), 362 TP_STRUCT__entry( 363 __string(path, key->ex_path.dentry->d_name.name) 364 __string(auth_domain, key->ex_client->name) 365 __field(int, status) 366 ), 367 TP_fast_assign( 368 __assign_str(path); 369 __assign_str(auth_domain); 370 __entry->status = status; 371 ), 372 TP_printk("path=%s domain=%s status=%d", 373 __get_str(path), 374 __get_str(auth_domain), 375 __entry->status 376 ) 377 ); 378 379 TRACE_EVENT(nfsd_export_update, 380 TP_PROTO(const struct svc_export *key), 381 TP_ARGS(key), 382 TP_STRUCT__entry( 383 __string(path, key->ex_path.dentry->d_name.name) 384 __string(auth_domain, key->ex_client->name) 385 __field(bool, cache) 386 ), 387 TP_fast_assign( 388 __assign_str(path); 389 __assign_str(auth_domain); 390 __entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags); 391 ), 392 TP_printk("path=%s domain=%s cache=%s", 393 __get_str(path), 394 __get_str(auth_domain), 395 __entry->cache ? "pos" : "neg" 396 ) 397 ); 398 399 DECLARE_EVENT_CLASS(nfsd_io_class, 400 TP_PROTO(struct svc_rqst *rqstp, 401 struct svc_fh *fhp, 402 u64 offset, 403 u32 len), 404 TP_ARGS(rqstp, fhp, offset, len), 405 TP_STRUCT__entry( 406 __field(u32, xid) 407 __field(u32, fh_hash) 408 __field(u64, offset) 409 __field(u32, len) 410 ), 411 TP_fast_assign( 412 __entry->xid = be32_to_cpu(rqstp->rq_xid); 413 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 414 __entry->offset = offset; 415 __entry->len = len; 416 ), 417 TP_printk("xid=0x%08x fh_hash=0x%08x offset=%llu len=%u", 418 __entry->xid, __entry->fh_hash, 419 __entry->offset, __entry->len) 420 ) 421 422 #define DEFINE_NFSD_IO_EVENT(name) \ 423 DEFINE_EVENT(nfsd_io_class, nfsd_##name, \ 424 TP_PROTO(struct svc_rqst *rqstp, \ 425 struct svc_fh *fhp, \ 426 u64 offset, \ 427 u32 len), \ 428 TP_ARGS(rqstp, fhp, offset, len)) 429 430 DEFINE_NFSD_IO_EVENT(read_start); 431 DEFINE_NFSD_IO_EVENT(read_splice); 432 DEFINE_NFSD_IO_EVENT(read_vector); 433 DEFINE_NFSD_IO_EVENT(read_io_done); 434 DEFINE_NFSD_IO_EVENT(read_done); 435 DEFINE_NFSD_IO_EVENT(write_start); 436 DEFINE_NFSD_IO_EVENT(write_opened); 437 DEFINE_NFSD_IO_EVENT(write_io_done); 438 DEFINE_NFSD_IO_EVENT(write_done); 439 440 DECLARE_EVENT_CLASS(nfsd_err_class, 441 TP_PROTO(struct svc_rqst *rqstp, 442 struct svc_fh *fhp, 443 loff_t offset, 444 int status), 445 TP_ARGS(rqstp, fhp, offset, status), 446 TP_STRUCT__entry( 447 __field(u32, xid) 448 __field(u32, fh_hash) 449 __field(loff_t, offset) 450 __field(int, status) 451 ), 452 TP_fast_assign( 453 __entry->xid = be32_to_cpu(rqstp->rq_xid); 454 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 455 __entry->offset = offset; 456 __entry->status = status; 457 ), 458 TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d", 459 __entry->xid, __entry->fh_hash, 460 __entry->offset, __entry->status) 461 ) 462 463 #define DEFINE_NFSD_ERR_EVENT(name) \ 464 DEFINE_EVENT(nfsd_err_class, nfsd_##name, \ 465 TP_PROTO(struct svc_rqst *rqstp, \ 466 struct svc_fh *fhp, \ 467 loff_t offset, \ 468 int len), \ 469 TP_ARGS(rqstp, fhp, offset, len)) 470 471 DEFINE_NFSD_ERR_EVENT(read_err); 472 DEFINE_NFSD_ERR_EVENT(write_err); 473 474 TRACE_EVENT(nfsd_dirent, 475 TP_PROTO(struct svc_fh *fhp, 476 u64 ino, 477 const char *name, 478 int namlen), 479 TP_ARGS(fhp, ino, name, namlen), 480 TP_STRUCT__entry( 481 __field(u32, fh_hash) 482 __field(u64, ino) 483 __string_len(name, name, namlen) 484 ), 485 TP_fast_assign( 486 __entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0; 487 __entry->ino = ino; 488 __assign_str(name); 489 ), 490 TP_printk("fh_hash=0x%08x ino=%llu name=%s", 491 __entry->fh_hash, __entry->ino, __get_str(name) 492 ) 493 ) 494 495 DECLARE_EVENT_CLASS(nfsd_copy_err_class, 496 TP_PROTO(struct svc_rqst *rqstp, 497 struct svc_fh *src_fhp, 498 loff_t src_offset, 499 struct svc_fh *dst_fhp, 500 loff_t dst_offset, 501 u64 count, 502 int status), 503 TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, count, status), 504 TP_STRUCT__entry( 505 __field(u32, xid) 506 __field(u32, src_fh_hash) 507 __field(loff_t, src_offset) 508 __field(u32, dst_fh_hash) 509 __field(loff_t, dst_offset) 510 __field(u64, count) 511 __field(int, status) 512 ), 513 TP_fast_assign( 514 __entry->xid = be32_to_cpu(rqstp->rq_xid); 515 __entry->src_fh_hash = knfsd_fh_hash(&src_fhp->fh_handle); 516 __entry->src_offset = src_offset; 517 __entry->dst_fh_hash = knfsd_fh_hash(&dst_fhp->fh_handle); 518 __entry->dst_offset = dst_offset; 519 __entry->count = count; 520 __entry->status = status; 521 ), 522 TP_printk("xid=0x%08x src_fh_hash=0x%08x src_offset=%lld " 523 "dst_fh_hash=0x%08x dst_offset=%lld " 524 "count=%llu status=%d", 525 __entry->xid, __entry->src_fh_hash, __entry->src_offset, 526 __entry->dst_fh_hash, __entry->dst_offset, 527 (unsigned long long)__entry->count, 528 __entry->status) 529 ) 530 531 #define DEFINE_NFSD_COPY_ERR_EVENT(name) \ 532 DEFINE_EVENT(nfsd_copy_err_class, nfsd_##name, \ 533 TP_PROTO(struct svc_rqst *rqstp, \ 534 struct svc_fh *src_fhp, \ 535 loff_t src_offset, \ 536 struct svc_fh *dst_fhp, \ 537 loff_t dst_offset, \ 538 u64 count, \ 539 int status), \ 540 TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, \ 541 count, status)) 542 543 DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err); 544 545 #include "state.h" 546 #include "filecache.h" 547 #include "vfs.h" 548 549 TRACE_EVENT(nfsd_delegret_wakeup, 550 TP_PROTO( 551 const struct svc_rqst *rqstp, 552 const struct inode *inode, 553 long timeo 554 ), 555 TP_ARGS(rqstp, inode, timeo), 556 TP_STRUCT__entry( 557 __field(u32, xid) 558 __field(const void *, inode) 559 __field(long, timeo) 560 ), 561 TP_fast_assign( 562 __entry->xid = be32_to_cpu(rqstp->rq_xid); 563 __entry->inode = inode; 564 __entry->timeo = timeo; 565 ), 566 TP_printk("xid=0x%08x inode=%p%s", 567 __entry->xid, __entry->inode, 568 __entry->timeo == 0 ? " (timed out)" : "" 569 ) 570 ); 571 572 DECLARE_EVENT_CLASS(nfsd_stateid_class, 573 TP_PROTO(stateid_t *stp), 574 TP_ARGS(stp), 575 TP_STRUCT__entry( 576 __field(u32, cl_boot) 577 __field(u32, cl_id) 578 __field(u32, si_id) 579 __field(u32, si_generation) 580 ), 581 TP_fast_assign( 582 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 583 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 584 __entry->si_id = stp->si_opaque.so_id; 585 __entry->si_generation = stp->si_generation; 586 ), 587 TP_printk("client %08x:%08x stateid %08x:%08x", 588 __entry->cl_boot, 589 __entry->cl_id, 590 __entry->si_id, 591 __entry->si_generation) 592 ) 593 594 #define DEFINE_STATEID_EVENT(name) \ 595 DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \ 596 TP_PROTO(stateid_t *stp), \ 597 TP_ARGS(stp)) 598 599 DEFINE_STATEID_EVENT(layoutstate_alloc); 600 DEFINE_STATEID_EVENT(layoutstate_unhash); 601 DEFINE_STATEID_EVENT(layoutstate_free); 602 DEFINE_STATEID_EVENT(layout_get_lookup_fail); 603 DEFINE_STATEID_EVENT(layout_commit_lookup_fail); 604 DEFINE_STATEID_EVENT(layout_return_lookup_fail); 605 DEFINE_STATEID_EVENT(layout_recall); 606 DEFINE_STATEID_EVENT(layout_recall_done); 607 DEFINE_STATEID_EVENT(layout_recall_fail); 608 DEFINE_STATEID_EVENT(layout_recall_release); 609 610 DEFINE_STATEID_EVENT(open); 611 DEFINE_STATEID_EVENT(deleg_read); 612 DEFINE_STATEID_EVENT(deleg_write); 613 DEFINE_STATEID_EVENT(deleg_return); 614 DEFINE_STATEID_EVENT(deleg_recall); 615 616 DECLARE_EVENT_CLASS(nfsd_stateseqid_class, 617 TP_PROTO(u32 seqid, const stateid_t *stp), 618 TP_ARGS(seqid, stp), 619 TP_STRUCT__entry( 620 __field(u32, seqid) 621 __field(u32, cl_boot) 622 __field(u32, cl_id) 623 __field(u32, si_id) 624 __field(u32, si_generation) 625 ), 626 TP_fast_assign( 627 __entry->seqid = seqid; 628 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 629 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 630 __entry->si_id = stp->si_opaque.so_id; 631 __entry->si_generation = stp->si_generation; 632 ), 633 TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x", 634 __entry->seqid, __entry->cl_boot, __entry->cl_id, 635 __entry->si_id, __entry->si_generation) 636 ) 637 638 #define DEFINE_STATESEQID_EVENT(name) \ 639 DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \ 640 TP_PROTO(u32 seqid, const stateid_t *stp), \ 641 TP_ARGS(seqid, stp)) 642 643 DEFINE_STATESEQID_EVENT(preprocess); 644 DEFINE_STATESEQID_EVENT(open_confirm); 645 646 #define show_stid_type(x) \ 647 __print_flags(x, "|", \ 648 { SC_TYPE_OPEN, "OPEN" }, \ 649 { SC_TYPE_LOCK, "LOCK" }, \ 650 { SC_TYPE_DELEG, "DELEG" }, \ 651 { SC_TYPE_LAYOUT, "LAYOUT" }) 652 653 #define show_stid_status(x) \ 654 __print_flags(x, "|", \ 655 { SC_STATUS_CLOSED, "CLOSED" }, \ 656 { SC_STATUS_REVOKED, "REVOKED" }, \ 657 { SC_STATUS_ADMIN_REVOKED, "ADMIN_REVOKED" }) 658 659 DECLARE_EVENT_CLASS(nfsd_stid_class, 660 TP_PROTO( 661 const struct nfs4_stid *stid 662 ), 663 TP_ARGS(stid), 664 TP_STRUCT__entry( 665 __field(unsigned long, sc_type) 666 __field(unsigned long, sc_status) 667 __field(int, sc_count) 668 __field(u32, cl_boot) 669 __field(u32, cl_id) 670 __field(u32, si_id) 671 __field(u32, si_generation) 672 ), 673 TP_fast_assign( 674 const stateid_t *stp = &stid->sc_stateid; 675 676 __entry->sc_type = stid->sc_type; 677 __entry->sc_status = stid->sc_status; 678 __entry->sc_count = refcount_read(&stid->sc_count); 679 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 680 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 681 __entry->si_id = stp->si_opaque.so_id; 682 __entry->si_generation = stp->si_generation; 683 ), 684 TP_printk("client %08x:%08x stateid %08x:%08x ref=%d type=%s state=%s", 685 __entry->cl_boot, __entry->cl_id, 686 __entry->si_id, __entry->si_generation, 687 __entry->sc_count, show_stid_type(__entry->sc_type), 688 show_stid_status(__entry->sc_status) 689 ) 690 ); 691 692 #define DEFINE_STID_EVENT(name) \ 693 DEFINE_EVENT(nfsd_stid_class, nfsd_stid_##name, \ 694 TP_PROTO(const struct nfs4_stid *stid), \ 695 TP_ARGS(stid)) 696 697 DEFINE_STID_EVENT(revoke); 698 699 TRACE_EVENT(nfsd_stateowner_replay, 700 TP_PROTO( 701 u32 opnum, 702 const struct nfs4_replay *rp 703 ), 704 TP_ARGS(opnum, rp), 705 TP_STRUCT__entry( 706 __field(unsigned long, status) 707 __field(u32, opnum) 708 ), 709 TP_fast_assign( 710 __entry->status = be32_to_cpu(rp->rp_status); 711 __entry->opnum = opnum; 712 ), 713 TP_printk("opnum=%u status=%lu", 714 __entry->opnum, __entry->status) 715 ); 716 717 TRACE_EVENT_CONDITION(nfsd_seq4_status, 718 TP_PROTO( 719 const struct svc_rqst *rqstp, 720 const struct nfsd4_sequence *sequence 721 ), 722 TP_ARGS(rqstp, sequence), 723 TP_CONDITION(sequence->status_flags), 724 TP_STRUCT__entry( 725 __field(unsigned int, netns_ino) 726 __field(u32, xid) 727 __field(u32, cl_boot) 728 __field(u32, cl_id) 729 __field(u32, seqno) 730 __field(u32, reserved) 731 __field(unsigned long, status_flags) 732 ), 733 TP_fast_assign( 734 const struct nfsd4_sessionid *sid = 735 (struct nfsd4_sessionid *)&sequence->sessionid; 736 737 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; 738 __entry->xid = be32_to_cpu(rqstp->rq_xid); 739 __entry->cl_boot = sid->clientid.cl_boot; 740 __entry->cl_id = sid->clientid.cl_id; 741 __entry->seqno = sid->sequence; 742 __entry->reserved = sid->reserved; 743 __entry->status_flags = sequence->status_flags; 744 ), 745 TP_printk("xid=0x%08x sessionid=%08x:%08x:%08x:%08x status_flags=%s", 746 __entry->xid, __entry->cl_boot, __entry->cl_id, 747 __entry->seqno, __entry->reserved, 748 show_nfs4_seq4_status(__entry->status_flags) 749 ) 750 ); 751 752 DECLARE_EVENT_CLASS(nfsd_cs_slot_class, 753 TP_PROTO( 754 const struct nfs4_client *clp, 755 const struct nfsd4_create_session *cs 756 ), 757 TP_ARGS(clp, cs), 758 TP_STRUCT__entry( 759 __field(u32, seqid) 760 __field(u32, slot_seqid) 761 __field(u32, cl_boot) 762 __field(u32, cl_id) 763 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 764 ), 765 TP_fast_assign( 766 const struct nfsd4_clid_slot *slot = &clp->cl_cs_slot; 767 768 __entry->cl_boot = clp->cl_clientid.cl_boot; 769 __entry->cl_id = clp->cl_clientid.cl_id; 770 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 771 clp->cl_cb_conn.cb_addrlen); 772 __entry->seqid = cs->seqid; 773 __entry->slot_seqid = slot->sl_seqid; 774 ), 775 TP_printk("addr=%pISpc client %08x:%08x seqid=%u slot_seqid=%u", 776 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 777 __entry->seqid, __entry->slot_seqid 778 ) 779 ); 780 781 #define DEFINE_CS_SLOT_EVENT(name) \ 782 DEFINE_EVENT(nfsd_cs_slot_class, nfsd_##name, \ 783 TP_PROTO( \ 784 const struct nfs4_client *clp, \ 785 const struct nfsd4_create_session *cs \ 786 ), \ 787 TP_ARGS(clp, cs)) 788 789 DEFINE_CS_SLOT_EVENT(slot_seqid_conf); 790 DEFINE_CS_SLOT_EVENT(slot_seqid_unconf); 791 792 TRACE_EVENT(nfsd_slot_seqid_sequence, 793 TP_PROTO( 794 const struct nfs4_client *clp, 795 const struct nfsd4_sequence *seq, 796 const struct nfsd4_slot *slot 797 ), 798 TP_ARGS(clp, seq, slot), 799 TP_STRUCT__entry( 800 __field(u32, seqid) 801 __field(u32, slot_seqid) 802 __field(u32, cl_boot) 803 __field(u32, cl_id) 804 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 805 __field(bool, in_use) 806 ), 807 TP_fast_assign( 808 __entry->cl_boot = clp->cl_clientid.cl_boot; 809 __entry->cl_id = clp->cl_clientid.cl_id; 810 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 811 clp->cl_cb_conn.cb_addrlen); 812 __entry->seqid = seq->seqid; 813 __entry->slot_seqid = slot->sl_seqid; 814 ), 815 TP_printk("addr=%pISpc client %08x:%08x seqid=%u slot_seqid=%u (%sin use)", 816 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 817 __entry->seqid, __entry->slot_seqid, 818 __entry->in_use ? "" : "not " 819 ) 820 ); 821 822 DECLARE_EVENT_CLASS(nfsd_clientid_class, 823 TP_PROTO(const clientid_t *clid), 824 TP_ARGS(clid), 825 TP_STRUCT__entry( 826 __field(u32, cl_boot) 827 __field(u32, cl_id) 828 ), 829 TP_fast_assign( 830 __entry->cl_boot = clid->cl_boot; 831 __entry->cl_id = clid->cl_id; 832 ), 833 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 834 ) 835 836 #define DEFINE_CLIENTID_EVENT(name) \ 837 DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \ 838 TP_PROTO(const clientid_t *clid), \ 839 TP_ARGS(clid)) 840 841 DEFINE_CLIENTID_EVENT(expire_unconf); 842 DEFINE_CLIENTID_EVENT(reclaim_complete); 843 DEFINE_CLIENTID_EVENT(confirmed); 844 DEFINE_CLIENTID_EVENT(destroyed); 845 DEFINE_CLIENTID_EVENT(admin_expired); 846 DEFINE_CLIENTID_EVENT(replaced); 847 DEFINE_CLIENTID_EVENT(purged); 848 DEFINE_CLIENTID_EVENT(renew); 849 DEFINE_CLIENTID_EVENT(stale); 850 851 TRACE_EVENT(nfsd_mark_client_expired, 852 TP_PROTO( 853 const struct nfs4_client *clp, 854 int cl_rpc_users 855 ), 856 TP_ARGS(clp, cl_rpc_users), 857 TP_STRUCT__entry( 858 __field(int, cl_rpc_users) 859 __field(u32, cl_boot) 860 __field(u32, cl_id) 861 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 862 ), 863 TP_fast_assign( 864 __entry->cl_rpc_users = cl_rpc_users; 865 __entry->cl_boot = clp->cl_clientid.cl_boot; 866 __entry->cl_id = clp->cl_clientid.cl_id; 867 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 868 clp->cl_cb_conn.cb_addrlen) 869 ), 870 TP_printk("addr=%pISpc client %08x:%08x cl_rpc_users=%d", 871 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 872 __entry->cl_rpc_users) 873 ); 874 875 DECLARE_EVENT_CLASS(nfsd_net_class, 876 TP_PROTO(const struct nfsd_net *nn), 877 TP_ARGS(nn), 878 TP_STRUCT__entry( 879 __field(unsigned long long, boot_time) 880 ), 881 TP_fast_assign( 882 __entry->boot_time = nn->boot_time; 883 ), 884 TP_printk("boot_time=%16llx", __entry->boot_time) 885 ) 886 887 #define DEFINE_NET_EVENT(name) \ 888 DEFINE_EVENT(nfsd_net_class, nfsd_##name, \ 889 TP_PROTO(const struct nfsd_net *nn), \ 890 TP_ARGS(nn)) 891 892 DEFINE_NET_EVENT(grace_start); 893 DEFINE_NET_EVENT(grace_complete); 894 895 TRACE_EVENT(nfsd_writeverf_reset, 896 TP_PROTO( 897 const struct nfsd_net *nn, 898 const struct svc_rqst *rqstp, 899 int error 900 ), 901 TP_ARGS(nn, rqstp, error), 902 TP_STRUCT__entry( 903 __field(unsigned long long, boot_time) 904 __field(u32, xid) 905 __field(int, error) 906 __array(unsigned char, verifier, NFS4_VERIFIER_SIZE) 907 ), 908 TP_fast_assign( 909 __entry->boot_time = nn->boot_time; 910 __entry->xid = be32_to_cpu(rqstp->rq_xid); 911 __entry->error = error; 912 913 /* avoid seqlock inside TP_fast_assign */ 914 memcpy(__entry->verifier, nn->writeverf, 915 NFS4_VERIFIER_SIZE); 916 ), 917 TP_printk("boot_time=%16llx xid=0x%08x error=%d new verifier=0x%s", 918 __entry->boot_time, __entry->xid, __entry->error, 919 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE) 920 ) 921 ); 922 923 TRACE_EVENT(nfsd_clid_cred_mismatch, 924 TP_PROTO( 925 const struct nfs4_client *clp, 926 const struct svc_rqst *rqstp 927 ), 928 TP_ARGS(clp, rqstp), 929 TP_STRUCT__entry( 930 __field(u32, cl_boot) 931 __field(u32, cl_id) 932 __field(unsigned long, cl_flavor) 933 __field(unsigned long, new_flavor) 934 __sockaddr(addr, rqstp->rq_xprt->xpt_remotelen) 935 ), 936 TP_fast_assign( 937 __entry->cl_boot = clp->cl_clientid.cl_boot; 938 __entry->cl_id = clp->cl_clientid.cl_id; 939 __entry->cl_flavor = clp->cl_cred.cr_flavor; 940 __entry->new_flavor = rqstp->rq_cred.cr_flavor; 941 __assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote, 942 rqstp->rq_xprt->xpt_remotelen); 943 ), 944 TP_printk("client %08x:%08x flavor=%s, conflict=%s from addr=%pISpc", 945 __entry->cl_boot, __entry->cl_id, 946 show_nfsd_authflavor(__entry->cl_flavor), 947 show_nfsd_authflavor(__entry->new_flavor), 948 __get_sockaddr(addr) 949 ) 950 ) 951 952 TRACE_EVENT(nfsd_clid_verf_mismatch, 953 TP_PROTO( 954 const struct nfs4_client *clp, 955 const struct svc_rqst *rqstp, 956 const nfs4_verifier *verf 957 ), 958 TP_ARGS(clp, rqstp, verf), 959 TP_STRUCT__entry( 960 __field(u32, cl_boot) 961 __field(u32, cl_id) 962 __array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE) 963 __array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE) 964 __sockaddr(addr, rqstp->rq_xprt->xpt_remotelen) 965 ), 966 TP_fast_assign( 967 __entry->cl_boot = clp->cl_clientid.cl_boot; 968 __entry->cl_id = clp->cl_clientid.cl_id; 969 memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier, 970 NFS4_VERIFIER_SIZE); 971 memcpy(__entry->new_verifier, (void *)verf, 972 NFS4_VERIFIER_SIZE); 973 __assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote, 974 rqstp->rq_xprt->xpt_remotelen); 975 ), 976 TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc", 977 __entry->cl_boot, __entry->cl_id, 978 __print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE), 979 __print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE), 980 __get_sockaddr(addr) 981 ) 982 ); 983 984 DECLARE_EVENT_CLASS(nfsd_clid_class, 985 TP_PROTO(const struct nfs4_client *clp), 986 TP_ARGS(clp), 987 TP_STRUCT__entry( 988 __field(u32, cl_boot) 989 __field(u32, cl_id) 990 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 991 __field(unsigned long, flavor) 992 __array(unsigned char, verifier, NFS4_VERIFIER_SIZE) 993 __string_len(name, clp->cl_name.data, clp->cl_name.len) 994 ), 995 TP_fast_assign( 996 __entry->cl_boot = clp->cl_clientid.cl_boot; 997 __entry->cl_id = clp->cl_clientid.cl_id; 998 memcpy(__entry->addr, &clp->cl_addr, 999 sizeof(struct sockaddr_in6)); 1000 __entry->flavor = clp->cl_cred.cr_flavor; 1001 memcpy(__entry->verifier, (void *)&clp->cl_verifier, 1002 NFS4_VERIFIER_SIZE); 1003 __assign_str(name); 1004 ), 1005 TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x", 1006 __entry->addr, __get_str(name), 1007 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE), 1008 show_nfsd_authflavor(__entry->flavor), 1009 __entry->cl_boot, __entry->cl_id) 1010 ); 1011 1012 #define DEFINE_CLID_EVENT(name) \ 1013 DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \ 1014 TP_PROTO(const struct nfs4_client *clp), \ 1015 TP_ARGS(clp)) 1016 1017 DEFINE_CLID_EVENT(fresh); 1018 DEFINE_CLID_EVENT(confirmed_r); 1019 1020 /* 1021 * from fs/nfsd/filecache.h 1022 */ 1023 #define show_nf_flags(val) \ 1024 __print_flags(val, "|", \ 1025 { 1 << NFSD_FILE_HASHED, "HASHED" }, \ 1026 { 1 << NFSD_FILE_PENDING, "PENDING" }, \ 1027 { 1 << NFSD_FILE_REFERENCED, "REFERENCED" }, \ 1028 { 1 << NFSD_FILE_GC, "GC" }) 1029 1030 DECLARE_EVENT_CLASS(nfsd_file_class, 1031 TP_PROTO(struct nfsd_file *nf), 1032 TP_ARGS(nf), 1033 TP_STRUCT__entry( 1034 __field(void *, nf_inode) 1035 __field(int, nf_ref) 1036 __field(unsigned long, nf_flags) 1037 __field(unsigned char, nf_may) 1038 __field(struct file *, nf_file) 1039 ), 1040 TP_fast_assign( 1041 __entry->nf_inode = nf->nf_inode; 1042 __entry->nf_ref = refcount_read(&nf->nf_ref); 1043 __entry->nf_flags = nf->nf_flags; 1044 __entry->nf_may = nf->nf_may; 1045 __entry->nf_file = nf->nf_file; 1046 ), 1047 TP_printk("inode=%p ref=%d flags=%s may=%s nf_file=%p", 1048 __entry->nf_inode, 1049 __entry->nf_ref, 1050 show_nf_flags(__entry->nf_flags), 1051 show_nfsd_may_flags(__entry->nf_may), 1052 __entry->nf_file) 1053 ) 1054 1055 #define DEFINE_NFSD_FILE_EVENT(name) \ 1056 DEFINE_EVENT(nfsd_file_class, name, \ 1057 TP_PROTO(struct nfsd_file *nf), \ 1058 TP_ARGS(nf)) 1059 1060 DEFINE_NFSD_FILE_EVENT(nfsd_file_free); 1061 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash); 1062 DEFINE_NFSD_FILE_EVENT(nfsd_file_put); 1063 DEFINE_NFSD_FILE_EVENT(nfsd_file_closing); 1064 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_queue); 1065 1066 TRACE_EVENT(nfsd_file_alloc, 1067 TP_PROTO( 1068 const struct nfsd_file *nf 1069 ), 1070 TP_ARGS(nf), 1071 TP_STRUCT__entry( 1072 __field(const void *, nf_inode) 1073 __field(unsigned long, nf_flags) 1074 __field(unsigned long, nf_may) 1075 __field(unsigned int, nf_ref) 1076 ), 1077 TP_fast_assign( 1078 __entry->nf_inode = nf->nf_inode; 1079 __entry->nf_flags = nf->nf_flags; 1080 __entry->nf_ref = refcount_read(&nf->nf_ref); 1081 __entry->nf_may = nf->nf_may; 1082 ), 1083 TP_printk("inode=%p ref=%u flags=%s may=%s", 1084 __entry->nf_inode, __entry->nf_ref, 1085 show_nf_flags(__entry->nf_flags), 1086 show_nfsd_may_flags(__entry->nf_may) 1087 ) 1088 ); 1089 1090 TRACE_EVENT(nfsd_file_acquire, 1091 TP_PROTO( 1092 const struct svc_rqst *rqstp, 1093 const struct inode *inode, 1094 unsigned int may_flags, 1095 const struct nfsd_file *nf, 1096 __be32 status 1097 ), 1098 1099 TP_ARGS(rqstp, inode, may_flags, nf, status), 1100 1101 TP_STRUCT__entry( 1102 __field(u32, xid) 1103 __field(const void *, inode) 1104 __field(unsigned long, may_flags) 1105 __field(unsigned int, nf_ref) 1106 __field(unsigned long, nf_flags) 1107 __field(unsigned long, nf_may) 1108 __field(const void *, nf_file) 1109 __field(u32, status) 1110 ), 1111 1112 TP_fast_assign( 1113 __entry->xid = be32_to_cpu(rqstp->rq_xid); 1114 __entry->inode = inode; 1115 __entry->may_flags = may_flags; 1116 __entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0; 1117 __entry->nf_flags = nf ? nf->nf_flags : 0; 1118 __entry->nf_may = nf ? nf->nf_may : 0; 1119 __entry->nf_file = nf ? nf->nf_file : NULL; 1120 __entry->status = be32_to_cpu(status); 1121 ), 1122 1123 TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p status=%u", 1124 __entry->xid, __entry->inode, 1125 show_nfsd_may_flags(__entry->may_flags), 1126 __entry->nf_ref, show_nf_flags(__entry->nf_flags), 1127 show_nfsd_may_flags(__entry->nf_may), 1128 __entry->nf_file, __entry->status 1129 ) 1130 ); 1131 1132 TRACE_EVENT(nfsd_file_insert_err, 1133 TP_PROTO( 1134 const struct svc_rqst *rqstp, 1135 const struct inode *inode, 1136 unsigned int may_flags, 1137 long error 1138 ), 1139 TP_ARGS(rqstp, inode, may_flags, error), 1140 TP_STRUCT__entry( 1141 __field(u32, xid) 1142 __field(const void *, inode) 1143 __field(unsigned long, may_flags) 1144 __field(long, error) 1145 ), 1146 TP_fast_assign( 1147 __entry->xid = be32_to_cpu(rqstp->rq_xid); 1148 __entry->inode = inode; 1149 __entry->may_flags = may_flags; 1150 __entry->error = error; 1151 ), 1152 TP_printk("xid=0x%x inode=%p may_flags=%s error=%ld", 1153 __entry->xid, __entry->inode, 1154 show_nfsd_may_flags(__entry->may_flags), 1155 __entry->error 1156 ) 1157 ); 1158 1159 TRACE_EVENT(nfsd_file_cons_err, 1160 TP_PROTO( 1161 const struct svc_rqst *rqstp, 1162 const struct inode *inode, 1163 unsigned int may_flags, 1164 const struct nfsd_file *nf 1165 ), 1166 TP_ARGS(rqstp, inode, may_flags, nf), 1167 TP_STRUCT__entry( 1168 __field(u32, xid) 1169 __field(const void *, inode) 1170 __field(unsigned long, may_flags) 1171 __field(unsigned int, nf_ref) 1172 __field(unsigned long, nf_flags) 1173 __field(unsigned long, nf_may) 1174 __field(const void *, nf_file) 1175 ), 1176 TP_fast_assign( 1177 __entry->xid = be32_to_cpu(rqstp->rq_xid); 1178 __entry->inode = inode; 1179 __entry->may_flags = may_flags; 1180 __entry->nf_ref = refcount_read(&nf->nf_ref); 1181 __entry->nf_flags = nf->nf_flags; 1182 __entry->nf_may = nf->nf_may; 1183 __entry->nf_file = nf->nf_file; 1184 ), 1185 TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p", 1186 __entry->xid, __entry->inode, 1187 show_nfsd_may_flags(__entry->may_flags), __entry->nf_ref, 1188 show_nf_flags(__entry->nf_flags), 1189 show_nfsd_may_flags(__entry->nf_may), __entry->nf_file 1190 ) 1191 ); 1192 1193 DECLARE_EVENT_CLASS(nfsd_file_open_class, 1194 TP_PROTO(const struct nfsd_file *nf, __be32 status), 1195 TP_ARGS(nf, status), 1196 TP_STRUCT__entry( 1197 __field(void *, nf_inode) /* cannot be dereferenced */ 1198 __field(int, nf_ref) 1199 __field(unsigned long, nf_flags) 1200 __field(unsigned long, nf_may) 1201 __field(void *, nf_file) /* cannot be dereferenced */ 1202 ), 1203 TP_fast_assign( 1204 __entry->nf_inode = nf->nf_inode; 1205 __entry->nf_ref = refcount_read(&nf->nf_ref); 1206 __entry->nf_flags = nf->nf_flags; 1207 __entry->nf_may = nf->nf_may; 1208 __entry->nf_file = nf->nf_file; 1209 ), 1210 TP_printk("inode=%p ref=%d flags=%s may=%s file=%p", 1211 __entry->nf_inode, 1212 __entry->nf_ref, 1213 show_nf_flags(__entry->nf_flags), 1214 show_nfsd_may_flags(__entry->nf_may), 1215 __entry->nf_file) 1216 ) 1217 1218 #define DEFINE_NFSD_FILE_OPEN_EVENT(name) \ 1219 DEFINE_EVENT(nfsd_file_open_class, name, \ 1220 TP_PROTO( \ 1221 const struct nfsd_file *nf, \ 1222 __be32 status \ 1223 ), \ 1224 TP_ARGS(nf, status)) 1225 1226 DEFINE_NFSD_FILE_OPEN_EVENT(nfsd_file_open); 1227 DEFINE_NFSD_FILE_OPEN_EVENT(nfsd_file_opened); 1228 1229 TRACE_EVENT(nfsd_file_is_cached, 1230 TP_PROTO( 1231 const struct inode *inode, 1232 int found 1233 ), 1234 TP_ARGS(inode, found), 1235 TP_STRUCT__entry( 1236 __field(const struct inode *, inode) 1237 __field(int, found) 1238 ), 1239 TP_fast_assign( 1240 __entry->inode = inode; 1241 __entry->found = found; 1242 ), 1243 TP_printk("inode=%p is %scached", 1244 __entry->inode, 1245 __entry->found ? "" : "not " 1246 ) 1247 ); 1248 1249 TRACE_EVENT(nfsd_file_fsnotify_handle_event, 1250 TP_PROTO(struct inode *inode, u32 mask), 1251 TP_ARGS(inode, mask), 1252 TP_STRUCT__entry( 1253 __field(struct inode *, inode) 1254 __field(unsigned int, nlink) 1255 __field(umode_t, mode) 1256 __field(u32, mask) 1257 ), 1258 TP_fast_assign( 1259 __entry->inode = inode; 1260 __entry->nlink = inode->i_nlink; 1261 __entry->mode = inode->i_mode; 1262 __entry->mask = mask; 1263 ), 1264 TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode, 1265 __entry->nlink, __entry->mode, __entry->mask) 1266 ); 1267 1268 DECLARE_EVENT_CLASS(nfsd_file_gc_class, 1269 TP_PROTO( 1270 const struct nfsd_file *nf 1271 ), 1272 TP_ARGS(nf), 1273 TP_STRUCT__entry( 1274 __field(void *, nf_inode) 1275 __field(void *, nf_file) 1276 __field(int, nf_ref) 1277 __field(unsigned long, nf_flags) 1278 ), 1279 TP_fast_assign( 1280 __entry->nf_inode = nf->nf_inode; 1281 __entry->nf_file = nf->nf_file; 1282 __entry->nf_ref = refcount_read(&nf->nf_ref); 1283 __entry->nf_flags = nf->nf_flags; 1284 ), 1285 TP_printk("inode=%p ref=%d nf_flags=%s nf_file=%p", 1286 __entry->nf_inode, __entry->nf_ref, 1287 show_nf_flags(__entry->nf_flags), 1288 __entry->nf_file 1289 ) 1290 ); 1291 1292 #define DEFINE_NFSD_FILE_GC_EVENT(name) \ 1293 DEFINE_EVENT(nfsd_file_gc_class, name, \ 1294 TP_PROTO( \ 1295 const struct nfsd_file *nf \ 1296 ), \ 1297 TP_ARGS(nf)) 1298 1299 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add); 1300 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add_disposed); 1301 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del); 1302 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del_disposed); 1303 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_in_use); 1304 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_writeback); 1305 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_referenced); 1306 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_disposed); 1307 1308 DECLARE_EVENT_CLASS(nfsd_file_lruwalk_class, 1309 TP_PROTO( 1310 unsigned long removed, 1311 unsigned long remaining 1312 ), 1313 TP_ARGS(removed, remaining), 1314 TP_STRUCT__entry( 1315 __field(unsigned long, removed) 1316 __field(unsigned long, remaining) 1317 ), 1318 TP_fast_assign( 1319 __entry->removed = removed; 1320 __entry->remaining = remaining; 1321 ), 1322 TP_printk("%lu entries removed, %lu remaining", 1323 __entry->removed, __entry->remaining) 1324 ); 1325 1326 #define DEFINE_NFSD_FILE_LRUWALK_EVENT(name) \ 1327 DEFINE_EVENT(nfsd_file_lruwalk_class, name, \ 1328 TP_PROTO( \ 1329 unsigned long removed, \ 1330 unsigned long remaining \ 1331 ), \ 1332 TP_ARGS(removed, remaining)) 1333 1334 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed); 1335 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed); 1336 1337 TRACE_EVENT(nfsd_file_close, 1338 TP_PROTO( 1339 const struct inode *inode 1340 ), 1341 TP_ARGS(inode), 1342 TP_STRUCT__entry( 1343 __field(const void *, inode) 1344 ), 1345 TP_fast_assign( 1346 __entry->inode = inode; 1347 ), 1348 TP_printk("inode=%p", 1349 __entry->inode 1350 ) 1351 ); 1352 1353 #include "cache.h" 1354 1355 TRACE_DEFINE_ENUM(RC_DROPIT); 1356 TRACE_DEFINE_ENUM(RC_REPLY); 1357 TRACE_DEFINE_ENUM(RC_DOIT); 1358 1359 #define show_drc_retval(x) \ 1360 __print_symbolic(x, \ 1361 { RC_DROPIT, "DROPIT" }, \ 1362 { RC_REPLY, "REPLY" }, \ 1363 { RC_DOIT, "DOIT" }) 1364 1365 TRACE_EVENT(nfsd_drc_found, 1366 TP_PROTO( 1367 const struct nfsd_net *nn, 1368 const struct svc_rqst *rqstp, 1369 int result 1370 ), 1371 TP_ARGS(nn, rqstp, result), 1372 TP_STRUCT__entry( 1373 __field(unsigned long long, boot_time) 1374 __field(unsigned long, result) 1375 __field(u32, xid) 1376 ), 1377 TP_fast_assign( 1378 __entry->boot_time = nn->boot_time; 1379 __entry->result = result; 1380 __entry->xid = be32_to_cpu(rqstp->rq_xid); 1381 ), 1382 TP_printk("boot_time=%16llx xid=0x%08x result=%s", 1383 __entry->boot_time, __entry->xid, 1384 show_drc_retval(__entry->result)) 1385 1386 ); 1387 1388 TRACE_EVENT(nfsd_drc_mismatch, 1389 TP_PROTO( 1390 const struct nfsd_net *nn, 1391 const struct nfsd_cacherep *key, 1392 const struct nfsd_cacherep *rp 1393 ), 1394 TP_ARGS(nn, key, rp), 1395 TP_STRUCT__entry( 1396 __field(unsigned long long, boot_time) 1397 __field(u32, xid) 1398 __field(u32, cached) 1399 __field(u32, ingress) 1400 ), 1401 TP_fast_assign( 1402 __entry->boot_time = nn->boot_time; 1403 __entry->xid = be32_to_cpu(key->c_key.k_xid); 1404 __entry->cached = (__force u32)key->c_key.k_csum; 1405 __entry->ingress = (__force u32)rp->c_key.k_csum; 1406 ), 1407 TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x", 1408 __entry->boot_time, __entry->xid, __entry->cached, 1409 __entry->ingress) 1410 ); 1411 1412 TRACE_EVENT(nfsd_cb_args, 1413 TP_PROTO( 1414 const struct nfs4_client *clp, 1415 const struct nfs4_cb_conn *conn 1416 ), 1417 TP_ARGS(clp, conn), 1418 TP_STRUCT__entry( 1419 __field(u32, cl_boot) 1420 __field(u32, cl_id) 1421 __field(u32, prog) 1422 __field(u32, ident) 1423 __sockaddr(addr, conn->cb_addrlen) 1424 ), 1425 TP_fast_assign( 1426 __entry->cl_boot = clp->cl_clientid.cl_boot; 1427 __entry->cl_id = clp->cl_clientid.cl_id; 1428 __entry->prog = conn->cb_prog; 1429 __entry->ident = conn->cb_ident; 1430 __assign_sockaddr(addr, &conn->cb_addr, conn->cb_addrlen); 1431 ), 1432 TP_printk("addr=%pISpc client %08x:%08x prog=%u ident=%u", 1433 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1434 __entry->prog, __entry->ident) 1435 ); 1436 1437 TRACE_EVENT(nfsd_cb_nodelegs, 1438 TP_PROTO(const struct nfs4_client *clp), 1439 TP_ARGS(clp), 1440 TP_STRUCT__entry( 1441 __field(u32, cl_boot) 1442 __field(u32, cl_id) 1443 ), 1444 TP_fast_assign( 1445 __entry->cl_boot = clp->cl_clientid.cl_boot; 1446 __entry->cl_id = clp->cl_clientid.cl_id; 1447 ), 1448 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 1449 ) 1450 1451 #define show_cb_state(val) \ 1452 __print_symbolic(val, \ 1453 { NFSD4_CB_UP, "UP" }, \ 1454 { NFSD4_CB_UNKNOWN, "UNKNOWN" }, \ 1455 { NFSD4_CB_DOWN, "DOWN" }, \ 1456 { NFSD4_CB_FAULT, "FAULT"}) 1457 1458 DECLARE_EVENT_CLASS(nfsd_cb_class, 1459 TP_PROTO(const struct nfs4_client *clp), 1460 TP_ARGS(clp), 1461 TP_STRUCT__entry( 1462 __field(unsigned long, state) 1463 __field(u32, cl_boot) 1464 __field(u32, cl_id) 1465 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1466 ), 1467 TP_fast_assign( 1468 __entry->state = clp->cl_cb_state; 1469 __entry->cl_boot = clp->cl_clientid.cl_boot; 1470 __entry->cl_id = clp->cl_clientid.cl_id; 1471 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1472 clp->cl_cb_conn.cb_addrlen) 1473 ), 1474 TP_printk("addr=%pISpc client %08x:%08x state=%s", 1475 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1476 show_cb_state(__entry->state)) 1477 ); 1478 1479 #define DEFINE_NFSD_CB_EVENT(name) \ 1480 DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name, \ 1481 TP_PROTO(const struct nfs4_client *clp), \ 1482 TP_ARGS(clp)) 1483 1484 DEFINE_NFSD_CB_EVENT(start); 1485 DEFINE_NFSD_CB_EVENT(new_state); 1486 DEFINE_NFSD_CB_EVENT(probe); 1487 DEFINE_NFSD_CB_EVENT(lost); 1488 DEFINE_NFSD_CB_EVENT(shutdown); 1489 1490 TRACE_DEFINE_ENUM(RPC_AUTH_NULL); 1491 TRACE_DEFINE_ENUM(RPC_AUTH_UNIX); 1492 TRACE_DEFINE_ENUM(RPC_AUTH_GSS); 1493 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 1494 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 1495 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 1496 1497 #define show_nfsd_authflavor(val) \ 1498 __print_symbolic(val, \ 1499 { RPC_AUTH_NULL, "none" }, \ 1500 { RPC_AUTH_UNIX, "sys" }, \ 1501 { RPC_AUTH_GSS, "gss" }, \ 1502 { RPC_AUTH_GSS_KRB5, "krb5" }, \ 1503 { RPC_AUTH_GSS_KRB5I, "krb5i" }, \ 1504 { RPC_AUTH_GSS_KRB5P, "krb5p" }) 1505 1506 TRACE_EVENT(nfsd_cb_setup, 1507 TP_PROTO(const struct nfs4_client *clp, 1508 const char *netid, 1509 rpc_authflavor_t authflavor 1510 ), 1511 TP_ARGS(clp, netid, authflavor), 1512 TP_STRUCT__entry( 1513 __field(u32, cl_boot) 1514 __field(u32, cl_id) 1515 __field(unsigned long, authflavor) 1516 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1517 __string(netid, netid) 1518 ), 1519 TP_fast_assign( 1520 __entry->cl_boot = clp->cl_clientid.cl_boot; 1521 __entry->cl_id = clp->cl_clientid.cl_id; 1522 __assign_str(netid); 1523 __entry->authflavor = authflavor; 1524 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1525 clp->cl_cb_conn.cb_addrlen) 1526 ), 1527 TP_printk("addr=%pISpc client %08x:%08x proto=%s flavor=%s", 1528 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1529 __get_str(netid), show_nfsd_authflavor(__entry->authflavor)) 1530 ); 1531 1532 TRACE_EVENT(nfsd_cb_setup_err, 1533 TP_PROTO( 1534 const struct nfs4_client *clp, 1535 long error 1536 ), 1537 TP_ARGS(clp, error), 1538 TP_STRUCT__entry( 1539 __field(long, error) 1540 __field(u32, cl_boot) 1541 __field(u32, cl_id) 1542 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1543 ), 1544 TP_fast_assign( 1545 __entry->error = error; 1546 __entry->cl_boot = clp->cl_clientid.cl_boot; 1547 __entry->cl_id = clp->cl_clientid.cl_id; 1548 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1549 clp->cl_cb_conn.cb_addrlen) 1550 ), 1551 TP_printk("addr=%pISpc client %08x:%08x error=%ld", 1552 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1553 __entry->error) 1554 ); 1555 1556 DECLARE_EVENT_CLASS(nfsd_cb_lifetime_class, 1557 TP_PROTO( 1558 const struct nfs4_client *clp, 1559 const struct nfsd4_callback *cb 1560 ), 1561 TP_ARGS(clp, cb), 1562 TP_STRUCT__entry( 1563 __field(u32, cl_boot) 1564 __field(u32, cl_id) 1565 __field(const void *, cb) 1566 __field(bool, need_restart) 1567 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1568 ), 1569 TP_fast_assign( 1570 __entry->cl_boot = clp->cl_clientid.cl_boot; 1571 __entry->cl_id = clp->cl_clientid.cl_id; 1572 __entry->cb = cb; 1573 __entry->need_restart = cb->cb_need_restart; 1574 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1575 clp->cl_cb_conn.cb_addrlen) 1576 ), 1577 TP_printk("addr=%pISpc client %08x:%08x cb=%p%s", 1578 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1579 __entry->cb, __entry->need_restart ? 1580 " (need restart)" : " (first try)" 1581 ) 1582 ); 1583 1584 #define DEFINE_NFSD_CB_LIFETIME_EVENT(name) \ 1585 DEFINE_EVENT(nfsd_cb_lifetime_class, nfsd_cb_##name, \ 1586 TP_PROTO( \ 1587 const struct nfs4_client *clp, \ 1588 const struct nfsd4_callback *cb \ 1589 ), \ 1590 TP_ARGS(clp, cb)) 1591 1592 DEFINE_NFSD_CB_LIFETIME_EVENT(queue); 1593 DEFINE_NFSD_CB_LIFETIME_EVENT(destroy); 1594 DEFINE_NFSD_CB_LIFETIME_EVENT(restart); 1595 DEFINE_NFSD_CB_LIFETIME_EVENT(bc_update); 1596 DEFINE_NFSD_CB_LIFETIME_EVENT(bc_shutdown); 1597 1598 TRACE_EVENT(nfsd_cb_seq_status, 1599 TP_PROTO( 1600 const struct rpc_task *task, 1601 const struct nfsd4_callback *cb 1602 ), 1603 TP_ARGS(task, cb), 1604 TP_STRUCT__entry( 1605 __field(unsigned int, task_id) 1606 __field(unsigned int, client_id) 1607 __field(u32, cl_boot) 1608 __field(u32, cl_id) 1609 __field(u32, seqno) 1610 __field(u32, reserved) 1611 __field(int, tk_status) 1612 __field(int, seq_status) 1613 ), 1614 TP_fast_assign( 1615 const struct nfs4_client *clp = cb->cb_clp; 1616 const struct nfsd4_session *session = clp->cl_cb_session; 1617 const struct nfsd4_sessionid *sid = 1618 (struct nfsd4_sessionid *)&session->se_sessionid; 1619 1620 __entry->task_id = task->tk_pid; 1621 __entry->client_id = task->tk_client ? 1622 task->tk_client->cl_clid : -1; 1623 __entry->cl_boot = sid->clientid.cl_boot; 1624 __entry->cl_id = sid->clientid.cl_id; 1625 __entry->seqno = sid->sequence; 1626 __entry->reserved = sid->reserved; 1627 __entry->tk_status = task->tk_status; 1628 __entry->seq_status = cb->cb_seq_status; 1629 ), 1630 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1631 " sessionid=%08x:%08x:%08x:%08x tk_status=%d seq_status=%d", 1632 __entry->task_id, __entry->client_id, 1633 __entry->cl_boot, __entry->cl_id, 1634 __entry->seqno, __entry->reserved, 1635 __entry->tk_status, __entry->seq_status 1636 ) 1637 ); 1638 1639 TRACE_EVENT(nfsd_cb_free_slot, 1640 TP_PROTO( 1641 const struct rpc_task *task, 1642 const struct nfsd4_callback *cb 1643 ), 1644 TP_ARGS(task, cb), 1645 TP_STRUCT__entry( 1646 __field(unsigned int, task_id) 1647 __field(unsigned int, client_id) 1648 __field(u32, cl_boot) 1649 __field(u32, cl_id) 1650 __field(u32, seqno) 1651 __field(u32, reserved) 1652 __field(u32, slot_seqno) 1653 ), 1654 TP_fast_assign( 1655 const struct nfs4_client *clp = cb->cb_clp; 1656 const struct nfsd4_session *session = clp->cl_cb_session; 1657 const struct nfsd4_sessionid *sid = 1658 (struct nfsd4_sessionid *)&session->se_sessionid; 1659 1660 __entry->task_id = task->tk_pid; 1661 __entry->client_id = task->tk_client ? 1662 task->tk_client->cl_clid : -1; 1663 __entry->cl_boot = sid->clientid.cl_boot; 1664 __entry->cl_id = sid->clientid.cl_id; 1665 __entry->seqno = sid->sequence; 1666 __entry->reserved = sid->reserved; 1667 __entry->slot_seqno = session->se_cb_seq_nr; 1668 ), 1669 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1670 " sessionid=%08x:%08x:%08x:%08x new slot seqno=%u", 1671 __entry->task_id, __entry->client_id, 1672 __entry->cl_boot, __entry->cl_id, 1673 __entry->seqno, __entry->reserved, 1674 __entry->slot_seqno 1675 ) 1676 ); 1677 1678 TRACE_EVENT_CONDITION(nfsd_cb_recall, 1679 TP_PROTO( 1680 const struct nfs4_stid *stid 1681 ), 1682 TP_ARGS(stid), 1683 TP_CONDITION(stid->sc_client), 1684 TP_STRUCT__entry( 1685 __field(u32, cl_boot) 1686 __field(u32, cl_id) 1687 __field(u32, si_id) 1688 __field(u32, si_generation) 1689 __sockaddr(addr, stid->sc_client->cl_cb_conn.cb_addrlen) 1690 ), 1691 TP_fast_assign( 1692 const stateid_t *stp = &stid->sc_stateid; 1693 const struct nfs4_client *clp = stid->sc_client; 1694 1695 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 1696 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 1697 __entry->si_id = stp->si_opaque.so_id; 1698 __entry->si_generation = stp->si_generation; 1699 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1700 clp->cl_cb_conn.cb_addrlen) 1701 ), 1702 TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x", 1703 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1704 __entry->si_id, __entry->si_generation) 1705 ); 1706 1707 TRACE_EVENT(nfsd_cb_notify_lock, 1708 TP_PROTO( 1709 const struct nfs4_lockowner *lo, 1710 const struct nfsd4_blocked_lock *nbl 1711 ), 1712 TP_ARGS(lo, nbl), 1713 TP_STRUCT__entry( 1714 __field(u32, cl_boot) 1715 __field(u32, cl_id) 1716 __field(u32, fh_hash) 1717 __sockaddr(addr, lo->lo_owner.so_client->cl_cb_conn.cb_addrlen) 1718 ), 1719 TP_fast_assign( 1720 const struct nfs4_client *clp = lo->lo_owner.so_client; 1721 1722 __entry->cl_boot = clp->cl_clientid.cl_boot; 1723 __entry->cl_id = clp->cl_clientid.cl_id; 1724 __entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh); 1725 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1726 clp->cl_cb_conn.cb_addrlen) 1727 ), 1728 TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x", 1729 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1730 __entry->fh_hash) 1731 ); 1732 1733 TRACE_EVENT(nfsd_cb_offload, 1734 TP_PROTO( 1735 const struct nfs4_client *clp, 1736 const stateid_t *stp, 1737 const struct knfsd_fh *fh, 1738 u64 count, 1739 __be32 status 1740 ), 1741 TP_ARGS(clp, stp, fh, count, status), 1742 TP_STRUCT__entry( 1743 __field(u32, cl_boot) 1744 __field(u32, cl_id) 1745 __field(u32, si_id) 1746 __field(u32, si_generation) 1747 __field(u32, fh_hash) 1748 __field(int, status) 1749 __field(u64, count) 1750 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1751 ), 1752 TP_fast_assign( 1753 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 1754 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 1755 __entry->si_id = stp->si_opaque.so_id; 1756 __entry->si_generation = stp->si_generation; 1757 __entry->fh_hash = knfsd_fh_hash(fh); 1758 __entry->status = be32_to_cpu(status); 1759 __entry->count = count; 1760 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1761 clp->cl_cb_conn.cb_addrlen) 1762 ), 1763 TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x fh_hash=0x%08x count=%llu status=%d", 1764 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1765 __entry->si_id, __entry->si_generation, 1766 __entry->fh_hash, __entry->count, __entry->status) 1767 ); 1768 1769 TRACE_EVENT(nfsd_cb_recall_any, 1770 TP_PROTO( 1771 const struct nfsd4_cb_recall_any *ra 1772 ), 1773 TP_ARGS(ra), 1774 TP_STRUCT__entry( 1775 __field(u32, cl_boot) 1776 __field(u32, cl_id) 1777 __field(u32, keep) 1778 __field(unsigned long, bmval0) 1779 __sockaddr(addr, ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen) 1780 ), 1781 TP_fast_assign( 1782 __entry->cl_boot = ra->ra_cb.cb_clp->cl_clientid.cl_boot; 1783 __entry->cl_id = ra->ra_cb.cb_clp->cl_clientid.cl_id; 1784 __entry->keep = ra->ra_keep; 1785 __entry->bmval0 = ra->ra_bmval[0]; 1786 __assign_sockaddr(addr, &ra->ra_cb.cb_clp->cl_addr, 1787 ra->ra_cb.cb_clp->cl_cb_conn.cb_addrlen); 1788 ), 1789 TP_printk("addr=%pISpc client %08x:%08x keep=%u bmval0=%s", 1790 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1791 __entry->keep, show_rca_mask(__entry->bmval0) 1792 ) 1793 ); 1794 1795 DECLARE_EVENT_CLASS(nfsd_cb_done_class, 1796 TP_PROTO( 1797 const stateid_t *stp, 1798 const struct rpc_task *task 1799 ), 1800 TP_ARGS(stp, task), 1801 TP_STRUCT__entry( 1802 __field(u32, cl_boot) 1803 __field(u32, cl_id) 1804 __field(u32, si_id) 1805 __field(u32, si_generation) 1806 __field(int, status) 1807 ), 1808 TP_fast_assign( 1809 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 1810 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 1811 __entry->si_id = stp->si_opaque.so_id; 1812 __entry->si_generation = stp->si_generation; 1813 __entry->status = task->tk_status; 1814 ), 1815 TP_printk("client %08x:%08x stateid %08x:%08x status=%d", 1816 __entry->cl_boot, __entry->cl_id, __entry->si_id, 1817 __entry->si_generation, __entry->status 1818 ) 1819 ); 1820 1821 #define DEFINE_NFSD_CB_DONE_EVENT(name) \ 1822 DEFINE_EVENT(nfsd_cb_done_class, name, \ 1823 TP_PROTO( \ 1824 const stateid_t *stp, \ 1825 const struct rpc_task *task \ 1826 ), \ 1827 TP_ARGS(stp, task)) 1828 1829 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_recall_done); 1830 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_notify_lock_done); 1831 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_layout_done); 1832 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_offload_done); 1833 1834 TRACE_EVENT(nfsd_cb_recall_any_done, 1835 TP_PROTO( 1836 const struct nfsd4_callback *cb, 1837 const struct rpc_task *task 1838 ), 1839 TP_ARGS(cb, task), 1840 TP_STRUCT__entry( 1841 __field(u32, cl_boot) 1842 __field(u32, cl_id) 1843 __field(int, status) 1844 ), 1845 TP_fast_assign( 1846 __entry->status = task->tk_status; 1847 __entry->cl_boot = cb->cb_clp->cl_clientid.cl_boot; 1848 __entry->cl_id = cb->cb_clp->cl_clientid.cl_id; 1849 ), 1850 TP_printk("client %08x:%08x status=%d", 1851 __entry->cl_boot, __entry->cl_id, __entry->status 1852 ) 1853 ); 1854 1855 TRACE_EVENT(nfsd_ctl_unlock_ip, 1856 TP_PROTO( 1857 const struct net *net, 1858 const char *address 1859 ), 1860 TP_ARGS(net, address), 1861 TP_STRUCT__entry( 1862 __field(unsigned int, netns_ino) 1863 __string(address, address) 1864 ), 1865 TP_fast_assign( 1866 __entry->netns_ino = net->ns.inum; 1867 __assign_str(address); 1868 ), 1869 TP_printk("address=%s", 1870 __get_str(address) 1871 ) 1872 ); 1873 1874 TRACE_EVENT(nfsd_ctl_unlock_fs, 1875 TP_PROTO( 1876 const struct net *net, 1877 const char *path 1878 ), 1879 TP_ARGS(net, path), 1880 TP_STRUCT__entry( 1881 __field(unsigned int, netns_ino) 1882 __string(path, path) 1883 ), 1884 TP_fast_assign( 1885 __entry->netns_ino = net->ns.inum; 1886 __assign_str(path); 1887 ), 1888 TP_printk("path=%s", 1889 __get_str(path) 1890 ) 1891 ); 1892 1893 TRACE_EVENT(nfsd_ctl_filehandle, 1894 TP_PROTO( 1895 const struct net *net, 1896 const char *domain, 1897 const char *path, 1898 int maxsize 1899 ), 1900 TP_ARGS(net, domain, path, maxsize), 1901 TP_STRUCT__entry( 1902 __field(unsigned int, netns_ino) 1903 __field(int, maxsize) 1904 __string(domain, domain) 1905 __string(path, path) 1906 ), 1907 TP_fast_assign( 1908 __entry->netns_ino = net->ns.inum; 1909 __entry->maxsize = maxsize; 1910 __assign_str(domain); 1911 __assign_str(path); 1912 ), 1913 TP_printk("domain=%s path=%s maxsize=%d", 1914 __get_str(domain), __get_str(path), __entry->maxsize 1915 ) 1916 ); 1917 1918 TRACE_EVENT(nfsd_ctl_threads, 1919 TP_PROTO( 1920 const struct net *net, 1921 int newthreads 1922 ), 1923 TP_ARGS(net, newthreads), 1924 TP_STRUCT__entry( 1925 __field(unsigned int, netns_ino) 1926 __field(int, newthreads) 1927 ), 1928 TP_fast_assign( 1929 __entry->netns_ino = net->ns.inum; 1930 __entry->newthreads = newthreads; 1931 ), 1932 TP_printk("newthreads=%d", 1933 __entry->newthreads 1934 ) 1935 ); 1936 1937 TRACE_EVENT(nfsd_ctl_pool_threads, 1938 TP_PROTO( 1939 const struct net *net, 1940 int pool, 1941 int nrthreads 1942 ), 1943 TP_ARGS(net, pool, nrthreads), 1944 TP_STRUCT__entry( 1945 __field(unsigned int, netns_ino) 1946 __field(int, pool) 1947 __field(int, nrthreads) 1948 ), 1949 TP_fast_assign( 1950 __entry->netns_ino = net->ns.inum; 1951 __entry->pool = pool; 1952 __entry->nrthreads = nrthreads; 1953 ), 1954 TP_printk("pool=%d nrthreads=%d", 1955 __entry->pool, __entry->nrthreads 1956 ) 1957 ); 1958 1959 TRACE_EVENT(nfsd_ctl_version, 1960 TP_PROTO( 1961 const struct net *net, 1962 const char *mesg 1963 ), 1964 TP_ARGS(net, mesg), 1965 TP_STRUCT__entry( 1966 __field(unsigned int, netns_ino) 1967 __string(mesg, mesg) 1968 ), 1969 TP_fast_assign( 1970 __entry->netns_ino = net->ns.inum; 1971 __assign_str(mesg); 1972 ), 1973 TP_printk("%s", 1974 __get_str(mesg) 1975 ) 1976 ); 1977 1978 TRACE_EVENT(nfsd_ctl_ports_addfd, 1979 TP_PROTO( 1980 const struct net *net, 1981 int fd 1982 ), 1983 TP_ARGS(net, fd), 1984 TP_STRUCT__entry( 1985 __field(unsigned int, netns_ino) 1986 __field(int, fd) 1987 ), 1988 TP_fast_assign( 1989 __entry->netns_ino = net->ns.inum; 1990 __entry->fd = fd; 1991 ), 1992 TP_printk("fd=%d", 1993 __entry->fd 1994 ) 1995 ); 1996 1997 TRACE_EVENT(nfsd_ctl_ports_addxprt, 1998 TP_PROTO( 1999 const struct net *net, 2000 const char *transport, 2001 int port 2002 ), 2003 TP_ARGS(net, transport, port), 2004 TP_STRUCT__entry( 2005 __field(unsigned int, netns_ino) 2006 __field(int, port) 2007 __string(transport, transport) 2008 ), 2009 TP_fast_assign( 2010 __entry->netns_ino = net->ns.inum; 2011 __entry->port = port; 2012 __assign_str(transport); 2013 ), 2014 TP_printk("transport=%s port=%d", 2015 __get_str(transport), __entry->port 2016 ) 2017 ); 2018 2019 TRACE_EVENT(nfsd_ctl_maxblksize, 2020 TP_PROTO( 2021 const struct net *net, 2022 int bsize 2023 ), 2024 TP_ARGS(net, bsize), 2025 TP_STRUCT__entry( 2026 __field(unsigned int, netns_ino) 2027 __field(int, bsize) 2028 ), 2029 TP_fast_assign( 2030 __entry->netns_ino = net->ns.inum; 2031 __entry->bsize = bsize; 2032 ), 2033 TP_printk("bsize=%d", 2034 __entry->bsize 2035 ) 2036 ); 2037 2038 TRACE_EVENT(nfsd_ctl_maxconn, 2039 TP_PROTO( 2040 const struct net *net, 2041 int maxconn 2042 ), 2043 TP_ARGS(net, maxconn), 2044 TP_STRUCT__entry( 2045 __field(unsigned int, netns_ino) 2046 __field(int, maxconn) 2047 ), 2048 TP_fast_assign( 2049 __entry->netns_ino = net->ns.inum; 2050 __entry->maxconn = maxconn; 2051 ), 2052 TP_printk("maxconn=%d", 2053 __entry->maxconn 2054 ) 2055 ); 2056 2057 TRACE_EVENT(nfsd_ctl_time, 2058 TP_PROTO( 2059 const struct net *net, 2060 const char *name, 2061 size_t namelen, 2062 int time 2063 ), 2064 TP_ARGS(net, name, namelen, time), 2065 TP_STRUCT__entry( 2066 __field(unsigned int, netns_ino) 2067 __field(int, time) 2068 __string_len(name, name, namelen) 2069 ), 2070 TP_fast_assign( 2071 __entry->netns_ino = net->ns.inum; 2072 __entry->time = time; 2073 __assign_str(name); 2074 ), 2075 TP_printk("file=%s time=%d", 2076 __get_str(name), __entry->time 2077 ) 2078 ); 2079 2080 TRACE_EVENT(nfsd_ctl_recoverydir, 2081 TP_PROTO( 2082 const struct net *net, 2083 const char *recdir 2084 ), 2085 TP_ARGS(net, recdir), 2086 TP_STRUCT__entry( 2087 __field(unsigned int, netns_ino) 2088 __string(recdir, recdir) 2089 ), 2090 TP_fast_assign( 2091 __entry->netns_ino = net->ns.inum; 2092 __assign_str(recdir); 2093 ), 2094 TP_printk("recdir=%s", 2095 __get_str(recdir) 2096 ) 2097 ); 2098 2099 TRACE_EVENT(nfsd_end_grace, 2100 TP_PROTO( 2101 const struct net *net 2102 ), 2103 TP_ARGS(net), 2104 TP_STRUCT__entry( 2105 __field(unsigned int, netns_ino) 2106 ), 2107 TP_fast_assign( 2108 __entry->netns_ino = net->ns.inum; 2109 ), 2110 TP_printk("nn=%d", __entry->netns_ino 2111 ) 2112 ); 2113 2114 DECLARE_EVENT_CLASS(nfsd_copy_class, 2115 TP_PROTO( 2116 const struct nfsd4_copy *copy 2117 ), 2118 TP_ARGS(copy), 2119 TP_STRUCT__entry( 2120 __field(bool, intra) 2121 __field(bool, async) 2122 __field(u32, src_cl_boot) 2123 __field(u32, src_cl_id) 2124 __field(u32, src_so_id) 2125 __field(u32, src_si_generation) 2126 __field(u32, dst_cl_boot) 2127 __field(u32, dst_cl_id) 2128 __field(u32, dst_so_id) 2129 __field(u32, dst_si_generation) 2130 __field(u64, src_cp_pos) 2131 __field(u64, dst_cp_pos) 2132 __field(u64, cp_count) 2133 __sockaddr(addr, sizeof(struct sockaddr_in6)) 2134 ), 2135 TP_fast_assign( 2136 const stateid_t *src_stp = ©->cp_src_stateid; 2137 const stateid_t *dst_stp = ©->cp_dst_stateid; 2138 2139 __entry->intra = test_bit(NFSD4_COPY_F_INTRA, ©->cp_flags); 2140 __entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, ©->cp_flags); 2141 __entry->src_cl_boot = src_stp->si_opaque.so_clid.cl_boot; 2142 __entry->src_cl_id = src_stp->si_opaque.so_clid.cl_id; 2143 __entry->src_so_id = src_stp->si_opaque.so_id; 2144 __entry->src_si_generation = src_stp->si_generation; 2145 __entry->dst_cl_boot = dst_stp->si_opaque.so_clid.cl_boot; 2146 __entry->dst_cl_id = dst_stp->si_opaque.so_clid.cl_id; 2147 __entry->dst_so_id = dst_stp->si_opaque.so_id; 2148 __entry->dst_si_generation = dst_stp->si_generation; 2149 __entry->src_cp_pos = copy->cp_src_pos; 2150 __entry->dst_cp_pos = copy->cp_dst_pos; 2151 __entry->cp_count = copy->cp_count; 2152 __assign_sockaddr(addr, ©->cp_clp->cl_addr, 2153 sizeof(struct sockaddr_in6)); 2154 ), 2155 TP_printk("client=%pISpc intra=%d async=%d " 2156 "src_stateid[si_generation:0x%x cl_boot:0x%x cl_id:0x%x so_id:0x%x] " 2157 "dst_stateid[si_generation:0x%x cl_boot:0x%x cl_id:0x%x so_id:0x%x] " 2158 "cp_src_pos=%llu cp_dst_pos=%llu cp_count=%llu", 2159 __get_sockaddr(addr), __entry->intra, __entry->async, 2160 __entry->src_si_generation, __entry->src_cl_boot, 2161 __entry->src_cl_id, __entry->src_so_id, 2162 __entry->dst_si_generation, __entry->dst_cl_boot, 2163 __entry->dst_cl_id, __entry->dst_so_id, 2164 __entry->src_cp_pos, __entry->dst_cp_pos, __entry->cp_count 2165 ) 2166 ); 2167 2168 #define DEFINE_COPY_EVENT(name) \ 2169 DEFINE_EVENT(nfsd_copy_class, nfsd_copy_##name, \ 2170 TP_PROTO(const struct nfsd4_copy *copy), \ 2171 TP_ARGS(copy)) 2172 2173 DEFINE_COPY_EVENT(inter); 2174 DEFINE_COPY_EVENT(intra); 2175 DEFINE_COPY_EVENT(do_async); 2176 2177 TRACE_EVENT(nfsd_copy_done, 2178 TP_PROTO( 2179 const struct nfsd4_copy *copy, 2180 __be32 status 2181 ), 2182 TP_ARGS(copy, status), 2183 TP_STRUCT__entry( 2184 __field(int, status) 2185 __field(bool, intra) 2186 __field(bool, async) 2187 __sockaddr(addr, sizeof(struct sockaddr_in6)) 2188 ), 2189 TP_fast_assign( 2190 __entry->status = be32_to_cpu(status); 2191 __entry->intra = test_bit(NFSD4_COPY_F_INTRA, ©->cp_flags); 2192 __entry->async = !test_bit(NFSD4_COPY_F_SYNCHRONOUS, ©->cp_flags); 2193 __assign_sockaddr(addr, ©->cp_clp->cl_addr, 2194 sizeof(struct sockaddr_in6)); 2195 ), 2196 TP_printk("addr=%pISpc status=%d intra=%d async=%d ", 2197 __get_sockaddr(addr), __entry->status, __entry->intra, __entry->async 2198 ) 2199 ); 2200 2201 #endif /* _NFSD_TRACE_H */ 2202 2203 #undef TRACE_INCLUDE_PATH 2204 #define TRACE_INCLUDE_PATH . 2205 #define TRACE_INCLUDE_FILE trace 2206 #include <trace/define_trace.h> 2207