1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2014 Christoph Hellwig. 4 */ 5 #undef TRACE_SYSTEM 6 #define TRACE_SYSTEM nfsd 7 8 #if !defined(_NFSD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 9 #define _NFSD_TRACE_H 10 11 #include <linux/tracepoint.h> 12 13 #include "export.h" 14 #include "nfsfh.h" 15 16 #define NFSD_TRACE_PROC_RES_FIELDS \ 17 __field(unsigned int, netns_ino) \ 18 __field(u32, xid) \ 19 __field(unsigned long, status) \ 20 __array(unsigned char, server, sizeof(struct sockaddr_in6)) \ 21 __array(unsigned char, client, sizeof(struct sockaddr_in6)) 22 23 #define NFSD_TRACE_PROC_RES_ASSIGNMENTS(error) \ 24 do { \ 25 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; \ 26 __entry->xid = be32_to_cpu(rqstp->rq_xid); \ 27 __entry->status = be32_to_cpu(error); \ 28 memcpy(__entry->server, &rqstp->rq_xprt->xpt_local, \ 29 rqstp->rq_xprt->xpt_locallen); \ 30 memcpy(__entry->client, &rqstp->rq_xprt->xpt_remote, \ 31 rqstp->rq_xprt->xpt_remotelen); \ 32 } while (0); 33 34 DECLARE_EVENT_CLASS(nfsd_xdr_err_class, 35 TP_PROTO( 36 const struct svc_rqst *rqstp 37 ), 38 TP_ARGS(rqstp), 39 TP_STRUCT__entry( 40 __field(unsigned int, netns_ino) 41 __field(u32, xid) 42 __field(u32, vers) 43 __field(u32, proc) 44 __sockaddr(server, rqstp->rq_xprt->xpt_locallen) 45 __sockaddr(client, rqstp->rq_xprt->xpt_remotelen) 46 ), 47 TP_fast_assign( 48 const struct svc_xprt *xprt = rqstp->rq_xprt; 49 50 __entry->netns_ino = xprt->xpt_net->ns.inum; 51 __entry->xid = be32_to_cpu(rqstp->rq_xid); 52 __entry->vers = rqstp->rq_vers; 53 __entry->proc = rqstp->rq_proc; 54 __assign_sockaddr(server, &xprt->xpt_local, xprt->xpt_locallen); 55 __assign_sockaddr(client, &xprt->xpt_remote, xprt->xpt_remotelen); 56 ), 57 TP_printk("xid=0x%08x vers=%u proc=%u", 58 __entry->xid, __entry->vers, __entry->proc 59 ) 60 ); 61 62 #define DEFINE_NFSD_XDR_ERR_EVENT(name) \ 63 DEFINE_EVENT(nfsd_xdr_err_class, nfsd_##name##_err, \ 64 TP_PROTO(const struct svc_rqst *rqstp), \ 65 TP_ARGS(rqstp)) 66 67 DEFINE_NFSD_XDR_ERR_EVENT(garbage_args); 68 DEFINE_NFSD_XDR_ERR_EVENT(cant_encode); 69 70 #define show_nfsd_may_flags(x) \ 71 __print_flags(x, "|", \ 72 { NFSD_MAY_EXEC, "EXEC" }, \ 73 { NFSD_MAY_WRITE, "WRITE" }, \ 74 { NFSD_MAY_READ, "READ" }, \ 75 { NFSD_MAY_SATTR, "SATTR" }, \ 76 { NFSD_MAY_TRUNC, "TRUNC" }, \ 77 { NFSD_MAY_LOCK, "LOCK" }, \ 78 { NFSD_MAY_OWNER_OVERRIDE, "OWNER_OVERRIDE" }, \ 79 { NFSD_MAY_LOCAL_ACCESS, "LOCAL_ACCESS" }, \ 80 { NFSD_MAY_BYPASS_GSS_ON_ROOT, "BYPASS_GSS_ON_ROOT" }, \ 81 { NFSD_MAY_NOT_BREAK_LEASE, "NOT_BREAK_LEASE" }, \ 82 { NFSD_MAY_BYPASS_GSS, "BYPASS_GSS" }, \ 83 { NFSD_MAY_READ_IF_EXEC, "READ_IF_EXEC" }, \ 84 { NFSD_MAY_64BIT_COOKIE, "64BIT_COOKIE" }) 85 86 TRACE_EVENT(nfsd_compound, 87 TP_PROTO( 88 const struct svc_rqst *rqst, 89 const char *tag, 90 u32 taglen, 91 u32 opcnt 92 ), 93 TP_ARGS(rqst, tag, taglen, opcnt), 94 TP_STRUCT__entry( 95 __field(u32, xid) 96 __field(u32, opcnt) 97 __string_len(tag, tag, taglen) 98 ), 99 TP_fast_assign( 100 __entry->xid = be32_to_cpu(rqst->rq_xid); 101 __entry->opcnt = opcnt; 102 __assign_str_len(tag, tag, taglen); 103 ), 104 TP_printk("xid=0x%08x opcnt=%u tag=%s", 105 __entry->xid, __entry->opcnt, __get_str(tag) 106 ) 107 ) 108 109 TRACE_EVENT(nfsd_compound_status, 110 TP_PROTO(u32 args_opcnt, 111 u32 resp_opcnt, 112 __be32 status, 113 const char *name), 114 TP_ARGS(args_opcnt, resp_opcnt, status, name), 115 TP_STRUCT__entry( 116 __field(u32, args_opcnt) 117 __field(u32, resp_opcnt) 118 __field(int, status) 119 __string(name, name) 120 ), 121 TP_fast_assign( 122 __entry->args_opcnt = args_opcnt; 123 __entry->resp_opcnt = resp_opcnt; 124 __entry->status = be32_to_cpu(status); 125 __assign_str(name, name); 126 ), 127 TP_printk("op=%u/%u %s status=%d", 128 __entry->resp_opcnt, __entry->args_opcnt, 129 __get_str(name), __entry->status) 130 ) 131 132 TRACE_EVENT(nfsd_compound_decode_err, 133 TP_PROTO( 134 const struct svc_rqst *rqstp, 135 u32 args_opcnt, 136 u32 resp_opcnt, 137 u32 opnum, 138 __be32 status 139 ), 140 TP_ARGS(rqstp, args_opcnt, resp_opcnt, opnum, status), 141 TP_STRUCT__entry( 142 NFSD_TRACE_PROC_RES_FIELDS 143 144 __field(u32, args_opcnt) 145 __field(u32, resp_opcnt) 146 __field(u32, opnum) 147 ), 148 TP_fast_assign( 149 NFSD_TRACE_PROC_RES_ASSIGNMENTS(status) 150 151 __entry->args_opcnt = args_opcnt; 152 __entry->resp_opcnt = resp_opcnt; 153 __entry->opnum = opnum; 154 ), 155 TP_printk("op=%u/%u opnum=%u status=%lu", 156 __entry->resp_opcnt, __entry->args_opcnt, 157 __entry->opnum, __entry->status) 158 ); 159 160 TRACE_EVENT(nfsd_compound_encode_err, 161 TP_PROTO( 162 const struct svc_rqst *rqstp, 163 u32 opnum, 164 __be32 status 165 ), 166 TP_ARGS(rqstp, opnum, status), 167 TP_STRUCT__entry( 168 NFSD_TRACE_PROC_RES_FIELDS 169 170 __field(u32, opnum) 171 ), 172 TP_fast_assign( 173 NFSD_TRACE_PROC_RES_ASSIGNMENTS(status) 174 175 __entry->opnum = opnum; 176 ), 177 TP_printk("opnum=%u status=%lu", 178 __entry->opnum, __entry->status) 179 ); 180 181 #define show_fs_file_type(x) \ 182 __print_symbolic(x, \ 183 { S_IFLNK, "LNK" }, \ 184 { S_IFREG, "REG" }, \ 185 { S_IFDIR, "DIR" }, \ 186 { S_IFCHR, "CHR" }, \ 187 { S_IFBLK, "BLK" }, \ 188 { S_IFIFO, "FIFO" }, \ 189 { S_IFSOCK, "SOCK" }) 190 191 TRACE_EVENT(nfsd_fh_verify, 192 TP_PROTO( 193 const struct svc_rqst *rqstp, 194 const struct svc_fh *fhp, 195 umode_t type, 196 int access 197 ), 198 TP_ARGS(rqstp, fhp, type, access), 199 TP_STRUCT__entry( 200 __field(unsigned int, netns_ino) 201 __sockaddr(server, rqstp->rq_xprt->xpt_remotelen) 202 __sockaddr(client, rqstp->rq_xprt->xpt_remotelen) 203 __field(u32, xid) 204 __field(u32, fh_hash) 205 __field(const void *, inode) 206 __field(unsigned long, type) 207 __field(unsigned long, access) 208 ), 209 TP_fast_assign( 210 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; 211 __assign_sockaddr(server, &rqstp->rq_xprt->xpt_local, 212 rqstp->rq_xprt->xpt_locallen); 213 __assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote, 214 rqstp->rq_xprt->xpt_remotelen); 215 __entry->xid = be32_to_cpu(rqstp->rq_xid); 216 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 217 __entry->inode = d_inode(fhp->fh_dentry); 218 __entry->type = type; 219 __entry->access = access; 220 ), 221 TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s", 222 __entry->xid, __entry->fh_hash, 223 show_fs_file_type(__entry->type), 224 show_nfsd_may_flags(__entry->access) 225 ) 226 ); 227 228 TRACE_EVENT_CONDITION(nfsd_fh_verify_err, 229 TP_PROTO( 230 const struct svc_rqst *rqstp, 231 const struct svc_fh *fhp, 232 umode_t type, 233 int access, 234 __be32 error 235 ), 236 TP_ARGS(rqstp, fhp, type, access, error), 237 TP_CONDITION(error), 238 TP_STRUCT__entry( 239 __field(unsigned int, netns_ino) 240 __sockaddr(server, rqstp->rq_xprt->xpt_remotelen) 241 __sockaddr(client, rqstp->rq_xprt->xpt_remotelen) 242 __field(u32, xid) 243 __field(u32, fh_hash) 244 __field(const void *, inode) 245 __field(unsigned long, type) 246 __field(unsigned long, access) 247 __field(int, error) 248 ), 249 TP_fast_assign( 250 __entry->netns_ino = SVC_NET(rqstp)->ns.inum; 251 __assign_sockaddr(server, &rqstp->rq_xprt->xpt_local, 252 rqstp->rq_xprt->xpt_locallen); 253 __assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote, 254 rqstp->rq_xprt->xpt_remotelen); 255 __entry->xid = be32_to_cpu(rqstp->rq_xid); 256 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 257 if (fhp->fh_dentry) 258 __entry->inode = d_inode(fhp->fh_dentry); 259 else 260 __entry->inode = NULL; 261 __entry->type = type; 262 __entry->access = access; 263 __entry->error = be32_to_cpu(error); 264 ), 265 TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s error=%d", 266 __entry->xid, __entry->fh_hash, 267 show_fs_file_type(__entry->type), 268 show_nfsd_may_flags(__entry->access), 269 __entry->error 270 ) 271 ); 272 273 DECLARE_EVENT_CLASS(nfsd_fh_err_class, 274 TP_PROTO(struct svc_rqst *rqstp, 275 struct svc_fh *fhp, 276 int status), 277 TP_ARGS(rqstp, fhp, status), 278 TP_STRUCT__entry( 279 __field(u32, xid) 280 __field(u32, fh_hash) 281 __field(int, status) 282 ), 283 TP_fast_assign( 284 __entry->xid = be32_to_cpu(rqstp->rq_xid); 285 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 286 __entry->status = status; 287 ), 288 TP_printk("xid=0x%08x fh_hash=0x%08x status=%d", 289 __entry->xid, __entry->fh_hash, 290 __entry->status) 291 ) 292 293 #define DEFINE_NFSD_FH_ERR_EVENT(name) \ 294 DEFINE_EVENT(nfsd_fh_err_class, nfsd_##name, \ 295 TP_PROTO(struct svc_rqst *rqstp, \ 296 struct svc_fh *fhp, \ 297 int status), \ 298 TP_ARGS(rqstp, fhp, status)) 299 300 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport); 301 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle); 302 303 TRACE_EVENT(nfsd_exp_find_key, 304 TP_PROTO(const struct svc_expkey *key, 305 int status), 306 TP_ARGS(key, status), 307 TP_STRUCT__entry( 308 __field(int, fsidtype) 309 __array(u32, fsid, 6) 310 __string(auth_domain, key->ek_client->name) 311 __field(int, status) 312 ), 313 TP_fast_assign( 314 __entry->fsidtype = key->ek_fsidtype; 315 memcpy(__entry->fsid, key->ek_fsid, 4*6); 316 __assign_str(auth_domain, key->ek_client->name); 317 __entry->status = status; 318 ), 319 TP_printk("fsid=%x::%s domain=%s status=%d", 320 __entry->fsidtype, 321 __print_array(__entry->fsid, 6, 4), 322 __get_str(auth_domain), 323 __entry->status 324 ) 325 ); 326 327 TRACE_EVENT(nfsd_expkey_update, 328 TP_PROTO(const struct svc_expkey *key, const char *exp_path), 329 TP_ARGS(key, exp_path), 330 TP_STRUCT__entry( 331 __field(int, fsidtype) 332 __array(u32, fsid, 6) 333 __string(auth_domain, key->ek_client->name) 334 __string(path, exp_path) 335 __field(bool, cache) 336 ), 337 TP_fast_assign( 338 __entry->fsidtype = key->ek_fsidtype; 339 memcpy(__entry->fsid, key->ek_fsid, 4*6); 340 __assign_str(auth_domain, key->ek_client->name); 341 __assign_str(path, exp_path); 342 __entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags); 343 ), 344 TP_printk("fsid=%x::%s domain=%s path=%s cache=%s", 345 __entry->fsidtype, 346 __print_array(__entry->fsid, 6, 4), 347 __get_str(auth_domain), 348 __get_str(path), 349 __entry->cache ? "pos" : "neg" 350 ) 351 ); 352 353 TRACE_EVENT(nfsd_exp_get_by_name, 354 TP_PROTO(const struct svc_export *key, 355 int status), 356 TP_ARGS(key, status), 357 TP_STRUCT__entry( 358 __string(path, key->ex_path.dentry->d_name.name) 359 __string(auth_domain, key->ex_client->name) 360 __field(int, status) 361 ), 362 TP_fast_assign( 363 __assign_str(path, key->ex_path.dentry->d_name.name); 364 __assign_str(auth_domain, key->ex_client->name); 365 __entry->status = status; 366 ), 367 TP_printk("path=%s domain=%s status=%d", 368 __get_str(path), 369 __get_str(auth_domain), 370 __entry->status 371 ) 372 ); 373 374 TRACE_EVENT(nfsd_export_update, 375 TP_PROTO(const struct svc_export *key), 376 TP_ARGS(key), 377 TP_STRUCT__entry( 378 __string(path, key->ex_path.dentry->d_name.name) 379 __string(auth_domain, key->ex_client->name) 380 __field(bool, cache) 381 ), 382 TP_fast_assign( 383 __assign_str(path, key->ex_path.dentry->d_name.name); 384 __assign_str(auth_domain, key->ex_client->name); 385 __entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags); 386 ), 387 TP_printk("path=%s domain=%s cache=%s", 388 __get_str(path), 389 __get_str(auth_domain), 390 __entry->cache ? "pos" : "neg" 391 ) 392 ); 393 394 DECLARE_EVENT_CLASS(nfsd_io_class, 395 TP_PROTO(struct svc_rqst *rqstp, 396 struct svc_fh *fhp, 397 u64 offset, 398 u32 len), 399 TP_ARGS(rqstp, fhp, offset, len), 400 TP_STRUCT__entry( 401 __field(u32, xid) 402 __field(u32, fh_hash) 403 __field(u64, offset) 404 __field(u32, len) 405 ), 406 TP_fast_assign( 407 __entry->xid = be32_to_cpu(rqstp->rq_xid); 408 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 409 __entry->offset = offset; 410 __entry->len = len; 411 ), 412 TP_printk("xid=0x%08x fh_hash=0x%08x offset=%llu len=%u", 413 __entry->xid, __entry->fh_hash, 414 __entry->offset, __entry->len) 415 ) 416 417 #define DEFINE_NFSD_IO_EVENT(name) \ 418 DEFINE_EVENT(nfsd_io_class, nfsd_##name, \ 419 TP_PROTO(struct svc_rqst *rqstp, \ 420 struct svc_fh *fhp, \ 421 u64 offset, \ 422 u32 len), \ 423 TP_ARGS(rqstp, fhp, offset, len)) 424 425 DEFINE_NFSD_IO_EVENT(read_start); 426 DEFINE_NFSD_IO_EVENT(read_splice); 427 DEFINE_NFSD_IO_EVENT(read_vector); 428 DEFINE_NFSD_IO_EVENT(read_io_done); 429 DEFINE_NFSD_IO_EVENT(read_done); 430 DEFINE_NFSD_IO_EVENT(write_start); 431 DEFINE_NFSD_IO_EVENT(write_opened); 432 DEFINE_NFSD_IO_EVENT(write_io_done); 433 DEFINE_NFSD_IO_EVENT(write_done); 434 435 DECLARE_EVENT_CLASS(nfsd_err_class, 436 TP_PROTO(struct svc_rqst *rqstp, 437 struct svc_fh *fhp, 438 loff_t offset, 439 int status), 440 TP_ARGS(rqstp, fhp, offset, status), 441 TP_STRUCT__entry( 442 __field(u32, xid) 443 __field(u32, fh_hash) 444 __field(loff_t, offset) 445 __field(int, status) 446 ), 447 TP_fast_assign( 448 __entry->xid = be32_to_cpu(rqstp->rq_xid); 449 __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); 450 __entry->offset = offset; 451 __entry->status = status; 452 ), 453 TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d", 454 __entry->xid, __entry->fh_hash, 455 __entry->offset, __entry->status) 456 ) 457 458 #define DEFINE_NFSD_ERR_EVENT(name) \ 459 DEFINE_EVENT(nfsd_err_class, nfsd_##name, \ 460 TP_PROTO(struct svc_rqst *rqstp, \ 461 struct svc_fh *fhp, \ 462 loff_t offset, \ 463 int len), \ 464 TP_ARGS(rqstp, fhp, offset, len)) 465 466 DEFINE_NFSD_ERR_EVENT(read_err); 467 DEFINE_NFSD_ERR_EVENT(write_err); 468 469 TRACE_EVENT(nfsd_dirent, 470 TP_PROTO(struct svc_fh *fhp, 471 u64 ino, 472 const char *name, 473 int namlen), 474 TP_ARGS(fhp, ino, name, namlen), 475 TP_STRUCT__entry( 476 __field(u32, fh_hash) 477 __field(u64, ino) 478 __string_len(name, name, namlen) 479 ), 480 TP_fast_assign( 481 __entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0; 482 __entry->ino = ino; 483 __assign_str_len(name, name, namlen) 484 ), 485 TP_printk("fh_hash=0x%08x ino=%llu name=%s", 486 __entry->fh_hash, __entry->ino, __get_str(name) 487 ) 488 ) 489 490 DECLARE_EVENT_CLASS(nfsd_copy_err_class, 491 TP_PROTO(struct svc_rqst *rqstp, 492 struct svc_fh *src_fhp, 493 loff_t src_offset, 494 struct svc_fh *dst_fhp, 495 loff_t dst_offset, 496 u64 count, 497 int status), 498 TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, count, status), 499 TP_STRUCT__entry( 500 __field(u32, xid) 501 __field(u32, src_fh_hash) 502 __field(loff_t, src_offset) 503 __field(u32, dst_fh_hash) 504 __field(loff_t, dst_offset) 505 __field(u64, count) 506 __field(int, status) 507 ), 508 TP_fast_assign( 509 __entry->xid = be32_to_cpu(rqstp->rq_xid); 510 __entry->src_fh_hash = knfsd_fh_hash(&src_fhp->fh_handle); 511 __entry->src_offset = src_offset; 512 __entry->dst_fh_hash = knfsd_fh_hash(&dst_fhp->fh_handle); 513 __entry->dst_offset = dst_offset; 514 __entry->count = count; 515 __entry->status = status; 516 ), 517 TP_printk("xid=0x%08x src_fh_hash=0x%08x src_offset=%lld " 518 "dst_fh_hash=0x%08x dst_offset=%lld " 519 "count=%llu status=%d", 520 __entry->xid, __entry->src_fh_hash, __entry->src_offset, 521 __entry->dst_fh_hash, __entry->dst_offset, 522 (unsigned long long)__entry->count, 523 __entry->status) 524 ) 525 526 #define DEFINE_NFSD_COPY_ERR_EVENT(name) \ 527 DEFINE_EVENT(nfsd_copy_err_class, nfsd_##name, \ 528 TP_PROTO(struct svc_rqst *rqstp, \ 529 struct svc_fh *src_fhp, \ 530 loff_t src_offset, \ 531 struct svc_fh *dst_fhp, \ 532 loff_t dst_offset, \ 533 u64 count, \ 534 int status), \ 535 TP_ARGS(rqstp, src_fhp, src_offset, dst_fhp, dst_offset, \ 536 count, status)) 537 538 DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err); 539 540 #include "state.h" 541 #include "filecache.h" 542 #include "vfs.h" 543 544 TRACE_EVENT(nfsd_delegret_wakeup, 545 TP_PROTO( 546 const struct svc_rqst *rqstp, 547 const struct inode *inode, 548 long timeo 549 ), 550 TP_ARGS(rqstp, inode, timeo), 551 TP_STRUCT__entry( 552 __field(u32, xid) 553 __field(const void *, inode) 554 __field(long, timeo) 555 ), 556 TP_fast_assign( 557 __entry->xid = be32_to_cpu(rqstp->rq_xid); 558 __entry->inode = inode; 559 __entry->timeo = timeo; 560 ), 561 TP_printk("xid=0x%08x inode=%p%s", 562 __entry->xid, __entry->inode, 563 __entry->timeo == 0 ? " (timed out)" : "" 564 ) 565 ); 566 567 DECLARE_EVENT_CLASS(nfsd_stateid_class, 568 TP_PROTO(stateid_t *stp), 569 TP_ARGS(stp), 570 TP_STRUCT__entry( 571 __field(u32, cl_boot) 572 __field(u32, cl_id) 573 __field(u32, si_id) 574 __field(u32, si_generation) 575 ), 576 TP_fast_assign( 577 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 578 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 579 __entry->si_id = stp->si_opaque.so_id; 580 __entry->si_generation = stp->si_generation; 581 ), 582 TP_printk("client %08x:%08x stateid %08x:%08x", 583 __entry->cl_boot, 584 __entry->cl_id, 585 __entry->si_id, 586 __entry->si_generation) 587 ) 588 589 #define DEFINE_STATEID_EVENT(name) \ 590 DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \ 591 TP_PROTO(stateid_t *stp), \ 592 TP_ARGS(stp)) 593 594 DEFINE_STATEID_EVENT(layoutstate_alloc); 595 DEFINE_STATEID_EVENT(layoutstate_unhash); 596 DEFINE_STATEID_EVENT(layoutstate_free); 597 DEFINE_STATEID_EVENT(layout_get_lookup_fail); 598 DEFINE_STATEID_EVENT(layout_commit_lookup_fail); 599 DEFINE_STATEID_EVENT(layout_return_lookup_fail); 600 DEFINE_STATEID_EVENT(layout_recall); 601 DEFINE_STATEID_EVENT(layout_recall_done); 602 DEFINE_STATEID_EVENT(layout_recall_fail); 603 DEFINE_STATEID_EVENT(layout_recall_release); 604 605 DEFINE_STATEID_EVENT(open); 606 DEFINE_STATEID_EVENT(deleg_read); 607 DEFINE_STATEID_EVENT(deleg_recall); 608 609 DECLARE_EVENT_CLASS(nfsd_stateseqid_class, 610 TP_PROTO(u32 seqid, const stateid_t *stp), 611 TP_ARGS(seqid, stp), 612 TP_STRUCT__entry( 613 __field(u32, seqid) 614 __field(u32, cl_boot) 615 __field(u32, cl_id) 616 __field(u32, si_id) 617 __field(u32, si_generation) 618 ), 619 TP_fast_assign( 620 __entry->seqid = seqid; 621 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 622 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 623 __entry->si_id = stp->si_opaque.so_id; 624 __entry->si_generation = stp->si_generation; 625 ), 626 TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x", 627 __entry->seqid, __entry->cl_boot, __entry->cl_id, 628 __entry->si_id, __entry->si_generation) 629 ) 630 631 #define DEFINE_STATESEQID_EVENT(name) \ 632 DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \ 633 TP_PROTO(u32 seqid, const stateid_t *stp), \ 634 TP_ARGS(seqid, stp)) 635 636 DEFINE_STATESEQID_EVENT(preprocess); 637 DEFINE_STATESEQID_EVENT(open_confirm); 638 639 DECLARE_EVENT_CLASS(nfsd_clientid_class, 640 TP_PROTO(const clientid_t *clid), 641 TP_ARGS(clid), 642 TP_STRUCT__entry( 643 __field(u32, cl_boot) 644 __field(u32, cl_id) 645 ), 646 TP_fast_assign( 647 __entry->cl_boot = clid->cl_boot; 648 __entry->cl_id = clid->cl_id; 649 ), 650 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 651 ) 652 653 #define DEFINE_CLIENTID_EVENT(name) \ 654 DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \ 655 TP_PROTO(const clientid_t *clid), \ 656 TP_ARGS(clid)) 657 658 DEFINE_CLIENTID_EVENT(expire_unconf); 659 DEFINE_CLIENTID_EVENT(reclaim_complete); 660 DEFINE_CLIENTID_EVENT(confirmed); 661 DEFINE_CLIENTID_EVENT(destroyed); 662 DEFINE_CLIENTID_EVENT(admin_expired); 663 DEFINE_CLIENTID_EVENT(replaced); 664 DEFINE_CLIENTID_EVENT(purged); 665 DEFINE_CLIENTID_EVENT(renew); 666 DEFINE_CLIENTID_EVENT(stale); 667 668 DECLARE_EVENT_CLASS(nfsd_net_class, 669 TP_PROTO(const struct nfsd_net *nn), 670 TP_ARGS(nn), 671 TP_STRUCT__entry( 672 __field(unsigned long long, boot_time) 673 ), 674 TP_fast_assign( 675 __entry->boot_time = nn->boot_time; 676 ), 677 TP_printk("boot_time=%16llx", __entry->boot_time) 678 ) 679 680 #define DEFINE_NET_EVENT(name) \ 681 DEFINE_EVENT(nfsd_net_class, nfsd_##name, \ 682 TP_PROTO(const struct nfsd_net *nn), \ 683 TP_ARGS(nn)) 684 685 DEFINE_NET_EVENT(grace_start); 686 DEFINE_NET_EVENT(grace_complete); 687 688 TRACE_EVENT(nfsd_writeverf_reset, 689 TP_PROTO( 690 const struct nfsd_net *nn, 691 const struct svc_rqst *rqstp, 692 int error 693 ), 694 TP_ARGS(nn, rqstp, error), 695 TP_STRUCT__entry( 696 __field(unsigned long long, boot_time) 697 __field(u32, xid) 698 __field(int, error) 699 __array(unsigned char, verifier, NFS4_VERIFIER_SIZE) 700 ), 701 TP_fast_assign( 702 __entry->boot_time = nn->boot_time; 703 __entry->xid = be32_to_cpu(rqstp->rq_xid); 704 __entry->error = error; 705 706 /* avoid seqlock inside TP_fast_assign */ 707 memcpy(__entry->verifier, nn->writeverf, 708 NFS4_VERIFIER_SIZE); 709 ), 710 TP_printk("boot_time=%16llx xid=0x%08x error=%d new verifier=0x%s", 711 __entry->boot_time, __entry->xid, __entry->error, 712 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE) 713 ) 714 ); 715 716 TRACE_EVENT(nfsd_clid_cred_mismatch, 717 TP_PROTO( 718 const struct nfs4_client *clp, 719 const struct svc_rqst *rqstp 720 ), 721 TP_ARGS(clp, rqstp), 722 TP_STRUCT__entry( 723 __field(u32, cl_boot) 724 __field(u32, cl_id) 725 __field(unsigned long, cl_flavor) 726 __field(unsigned long, new_flavor) 727 __sockaddr(addr, rqstp->rq_xprt->xpt_remotelen) 728 ), 729 TP_fast_assign( 730 __entry->cl_boot = clp->cl_clientid.cl_boot; 731 __entry->cl_id = clp->cl_clientid.cl_id; 732 __entry->cl_flavor = clp->cl_cred.cr_flavor; 733 __entry->new_flavor = rqstp->rq_cred.cr_flavor; 734 __assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote, 735 rqstp->rq_xprt->xpt_remotelen); 736 ), 737 TP_printk("client %08x:%08x flavor=%s, conflict=%s from addr=%pISpc", 738 __entry->cl_boot, __entry->cl_id, 739 show_nfsd_authflavor(__entry->cl_flavor), 740 show_nfsd_authflavor(__entry->new_flavor), 741 __get_sockaddr(addr) 742 ) 743 ) 744 745 TRACE_EVENT(nfsd_clid_verf_mismatch, 746 TP_PROTO( 747 const struct nfs4_client *clp, 748 const struct svc_rqst *rqstp, 749 const nfs4_verifier *verf 750 ), 751 TP_ARGS(clp, rqstp, verf), 752 TP_STRUCT__entry( 753 __field(u32, cl_boot) 754 __field(u32, cl_id) 755 __array(unsigned char, cl_verifier, NFS4_VERIFIER_SIZE) 756 __array(unsigned char, new_verifier, NFS4_VERIFIER_SIZE) 757 __sockaddr(addr, rqstp->rq_xprt->xpt_remotelen) 758 ), 759 TP_fast_assign( 760 __entry->cl_boot = clp->cl_clientid.cl_boot; 761 __entry->cl_id = clp->cl_clientid.cl_id; 762 memcpy(__entry->cl_verifier, (void *)&clp->cl_verifier, 763 NFS4_VERIFIER_SIZE); 764 memcpy(__entry->new_verifier, (void *)verf, 765 NFS4_VERIFIER_SIZE); 766 __assign_sockaddr(addr, &rqstp->rq_xprt->xpt_remote, 767 rqstp->rq_xprt->xpt_remotelen); 768 ), 769 TP_printk("client %08x:%08x verf=0x%s, updated=0x%s from addr=%pISpc", 770 __entry->cl_boot, __entry->cl_id, 771 __print_hex_str(__entry->cl_verifier, NFS4_VERIFIER_SIZE), 772 __print_hex_str(__entry->new_verifier, NFS4_VERIFIER_SIZE), 773 __get_sockaddr(addr) 774 ) 775 ); 776 777 DECLARE_EVENT_CLASS(nfsd_clid_class, 778 TP_PROTO(const struct nfs4_client *clp), 779 TP_ARGS(clp), 780 TP_STRUCT__entry( 781 __field(u32, cl_boot) 782 __field(u32, cl_id) 783 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 784 __field(unsigned long, flavor) 785 __array(unsigned char, verifier, NFS4_VERIFIER_SIZE) 786 __string_len(name, name, clp->cl_name.len) 787 ), 788 TP_fast_assign( 789 __entry->cl_boot = clp->cl_clientid.cl_boot; 790 __entry->cl_id = clp->cl_clientid.cl_id; 791 memcpy(__entry->addr, &clp->cl_addr, 792 sizeof(struct sockaddr_in6)); 793 __entry->flavor = clp->cl_cred.cr_flavor; 794 memcpy(__entry->verifier, (void *)&clp->cl_verifier, 795 NFS4_VERIFIER_SIZE); 796 __assign_str_len(name, clp->cl_name.data, clp->cl_name.len); 797 ), 798 TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x", 799 __entry->addr, __get_str(name), 800 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE), 801 show_nfsd_authflavor(__entry->flavor), 802 __entry->cl_boot, __entry->cl_id) 803 ); 804 805 #define DEFINE_CLID_EVENT(name) \ 806 DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \ 807 TP_PROTO(const struct nfs4_client *clp), \ 808 TP_ARGS(clp)) 809 810 DEFINE_CLID_EVENT(fresh); 811 DEFINE_CLID_EVENT(confirmed_r); 812 813 /* 814 * from fs/nfsd/filecache.h 815 */ 816 #define show_nf_flags(val) \ 817 __print_flags(val, "|", \ 818 { 1 << NFSD_FILE_HASHED, "HASHED" }, \ 819 { 1 << NFSD_FILE_PENDING, "PENDING" }, \ 820 { 1 << NFSD_FILE_REFERENCED, "REFERENCED"}) 821 822 DECLARE_EVENT_CLASS(nfsd_file_class, 823 TP_PROTO(struct nfsd_file *nf), 824 TP_ARGS(nf), 825 TP_STRUCT__entry( 826 __field(void *, nf_inode) 827 __field(int, nf_ref) 828 __field(unsigned long, nf_flags) 829 __field(unsigned char, nf_may) 830 __field(struct file *, nf_file) 831 ), 832 TP_fast_assign( 833 __entry->nf_inode = nf->nf_inode; 834 __entry->nf_ref = refcount_read(&nf->nf_ref); 835 __entry->nf_flags = nf->nf_flags; 836 __entry->nf_may = nf->nf_may; 837 __entry->nf_file = nf->nf_file; 838 ), 839 TP_printk("inode=%p ref=%d flags=%s may=%s nf_file=%p", 840 __entry->nf_inode, 841 __entry->nf_ref, 842 show_nf_flags(__entry->nf_flags), 843 show_nfsd_may_flags(__entry->nf_may), 844 __entry->nf_file) 845 ) 846 847 #define DEFINE_NFSD_FILE_EVENT(name) \ 848 DEFINE_EVENT(nfsd_file_class, name, \ 849 TP_PROTO(struct nfsd_file *nf), \ 850 TP_ARGS(nf)) 851 852 DEFINE_NFSD_FILE_EVENT(nfsd_file_put_final); 853 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash); 854 DEFINE_NFSD_FILE_EVENT(nfsd_file_put); 855 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_dispose); 856 857 TRACE_EVENT(nfsd_file_alloc, 858 TP_PROTO( 859 const struct nfsd_file *nf 860 ), 861 TP_ARGS(nf), 862 TP_STRUCT__entry( 863 __field(const void *, nf_inode) 864 __field(unsigned long, nf_flags) 865 __field(unsigned long, nf_may) 866 __field(unsigned int, nf_ref) 867 ), 868 TP_fast_assign( 869 __entry->nf_inode = nf->nf_inode; 870 __entry->nf_flags = nf->nf_flags; 871 __entry->nf_ref = refcount_read(&nf->nf_ref); 872 __entry->nf_may = nf->nf_may; 873 ), 874 TP_printk("inode=%p ref=%u flags=%s may=%s", 875 __entry->nf_inode, __entry->nf_ref, 876 show_nf_flags(__entry->nf_flags), 877 show_nfsd_may_flags(__entry->nf_may) 878 ) 879 ); 880 881 TRACE_EVENT(nfsd_file_acquire, 882 TP_PROTO( 883 const struct svc_rqst *rqstp, 884 const struct inode *inode, 885 unsigned int may_flags, 886 const struct nfsd_file *nf, 887 __be32 status 888 ), 889 890 TP_ARGS(rqstp, inode, may_flags, nf, status), 891 892 TP_STRUCT__entry( 893 __field(u32, xid) 894 __field(const void *, inode) 895 __field(unsigned long, may_flags) 896 __field(unsigned int, nf_ref) 897 __field(unsigned long, nf_flags) 898 __field(unsigned long, nf_may) 899 __field(const void *, nf_file) 900 __field(u32, status) 901 ), 902 903 TP_fast_assign( 904 __entry->xid = be32_to_cpu(rqstp->rq_xid); 905 __entry->inode = inode; 906 __entry->may_flags = may_flags; 907 __entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0; 908 __entry->nf_flags = nf ? nf->nf_flags : 0; 909 __entry->nf_may = nf ? nf->nf_may : 0; 910 __entry->nf_file = nf ? nf->nf_file : NULL; 911 __entry->status = be32_to_cpu(status); 912 ), 913 914 TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p status=%u", 915 __entry->xid, __entry->inode, 916 show_nfsd_may_flags(__entry->may_flags), 917 __entry->nf_ref, show_nf_flags(__entry->nf_flags), 918 show_nfsd_may_flags(__entry->nf_may), 919 __entry->nf_file, __entry->status 920 ) 921 ); 922 923 TRACE_EVENT(nfsd_file_create, 924 TP_PROTO( 925 const struct svc_rqst *rqstp, 926 unsigned int may_flags, 927 const struct nfsd_file *nf 928 ), 929 930 TP_ARGS(rqstp, may_flags, nf), 931 932 TP_STRUCT__entry( 933 __field(const void *, nf_inode) 934 __field(const void *, nf_file) 935 __field(unsigned long, may_flags) 936 __field(unsigned long, nf_flags) 937 __field(unsigned long, nf_may) 938 __field(unsigned int, nf_ref) 939 __field(u32, xid) 940 ), 941 942 TP_fast_assign( 943 __entry->nf_inode = nf->nf_inode; 944 __entry->nf_file = nf->nf_file; 945 __entry->may_flags = may_flags; 946 __entry->nf_flags = nf->nf_flags; 947 __entry->nf_may = nf->nf_may; 948 __entry->nf_ref = refcount_read(&nf->nf_ref); 949 __entry->xid = be32_to_cpu(rqstp->rq_xid); 950 ), 951 952 TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p", 953 __entry->xid, __entry->nf_inode, 954 show_nfsd_may_flags(__entry->may_flags), 955 __entry->nf_ref, show_nf_flags(__entry->nf_flags), 956 show_nfsd_may_flags(__entry->nf_may), __entry->nf_file 957 ) 958 ); 959 960 TRACE_EVENT(nfsd_file_insert_err, 961 TP_PROTO( 962 const struct svc_rqst *rqstp, 963 const struct inode *inode, 964 unsigned int may_flags, 965 long error 966 ), 967 TP_ARGS(rqstp, inode, may_flags, error), 968 TP_STRUCT__entry( 969 __field(u32, xid) 970 __field(const void *, inode) 971 __field(unsigned long, may_flags) 972 __field(long, error) 973 ), 974 TP_fast_assign( 975 __entry->xid = be32_to_cpu(rqstp->rq_xid); 976 __entry->inode = inode; 977 __entry->may_flags = may_flags; 978 __entry->error = error; 979 ), 980 TP_printk("xid=0x%x inode=%p may_flags=%s error=%ld", 981 __entry->xid, __entry->inode, 982 show_nfsd_may_flags(__entry->may_flags), 983 __entry->error 984 ) 985 ); 986 987 TRACE_EVENT(nfsd_file_cons_err, 988 TP_PROTO( 989 const struct svc_rqst *rqstp, 990 const struct inode *inode, 991 unsigned int may_flags, 992 const struct nfsd_file *nf 993 ), 994 TP_ARGS(rqstp, inode, may_flags, nf), 995 TP_STRUCT__entry( 996 __field(u32, xid) 997 __field(const void *, inode) 998 __field(unsigned long, may_flags) 999 __field(unsigned int, nf_ref) 1000 __field(unsigned long, nf_flags) 1001 __field(unsigned long, nf_may) 1002 __field(const void *, nf_file) 1003 ), 1004 TP_fast_assign( 1005 __entry->xid = be32_to_cpu(rqstp->rq_xid); 1006 __entry->inode = inode; 1007 __entry->may_flags = may_flags; 1008 __entry->nf_ref = refcount_read(&nf->nf_ref); 1009 __entry->nf_flags = nf->nf_flags; 1010 __entry->nf_may = nf->nf_may; 1011 __entry->nf_file = nf->nf_file; 1012 ), 1013 TP_printk("xid=0x%x inode=%p may_flags=%s ref=%u nf_flags=%s nf_may=%s nf_file=%p", 1014 __entry->xid, __entry->inode, 1015 show_nfsd_may_flags(__entry->may_flags), __entry->nf_ref, 1016 show_nf_flags(__entry->nf_flags), 1017 show_nfsd_may_flags(__entry->nf_may), __entry->nf_file 1018 ) 1019 ); 1020 1021 TRACE_EVENT(nfsd_file_open, 1022 TP_PROTO(struct nfsd_file *nf, __be32 status), 1023 TP_ARGS(nf, status), 1024 TP_STRUCT__entry( 1025 __field(void *, nf_inode) /* cannot be dereferenced */ 1026 __field(int, nf_ref) 1027 __field(unsigned long, nf_flags) 1028 __field(unsigned long, nf_may) 1029 __field(void *, nf_file) /* cannot be dereferenced */ 1030 ), 1031 TP_fast_assign( 1032 __entry->nf_inode = nf->nf_inode; 1033 __entry->nf_ref = refcount_read(&nf->nf_ref); 1034 __entry->nf_flags = nf->nf_flags; 1035 __entry->nf_may = nf->nf_may; 1036 __entry->nf_file = nf->nf_file; 1037 ), 1038 TP_printk("inode=%p ref=%d flags=%s may=%s file=%p", 1039 __entry->nf_inode, 1040 __entry->nf_ref, 1041 show_nf_flags(__entry->nf_flags), 1042 show_nfsd_may_flags(__entry->nf_may), 1043 __entry->nf_file) 1044 ) 1045 1046 DECLARE_EVENT_CLASS(nfsd_file_search_class, 1047 TP_PROTO( 1048 const struct inode *inode, 1049 unsigned int count 1050 ), 1051 TP_ARGS(inode, count), 1052 TP_STRUCT__entry( 1053 __field(const struct inode *, inode) 1054 __field(unsigned int, count) 1055 ), 1056 TP_fast_assign( 1057 __entry->inode = inode; 1058 __entry->count = count; 1059 ), 1060 TP_printk("inode=%p count=%u", 1061 __entry->inode, __entry->count) 1062 ); 1063 1064 #define DEFINE_NFSD_FILE_SEARCH_EVENT(name) \ 1065 DEFINE_EVENT(nfsd_file_search_class, name, \ 1066 TP_PROTO( \ 1067 const struct inode *inode, \ 1068 unsigned int count \ 1069 ), \ 1070 TP_ARGS(inode, count)) 1071 1072 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync); 1073 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode); 1074 1075 TRACE_EVENT(nfsd_file_is_cached, 1076 TP_PROTO( 1077 const struct inode *inode, 1078 int found 1079 ), 1080 TP_ARGS(inode, found), 1081 TP_STRUCT__entry( 1082 __field(const struct inode *, inode) 1083 __field(int, found) 1084 ), 1085 TP_fast_assign( 1086 __entry->inode = inode; 1087 __entry->found = found; 1088 ), 1089 TP_printk("inode=%p is %scached", 1090 __entry->inode, 1091 __entry->found ? "" : "not " 1092 ) 1093 ); 1094 1095 TRACE_EVENT(nfsd_file_fsnotify_handle_event, 1096 TP_PROTO(struct inode *inode, u32 mask), 1097 TP_ARGS(inode, mask), 1098 TP_STRUCT__entry( 1099 __field(struct inode *, inode) 1100 __field(unsigned int, nlink) 1101 __field(umode_t, mode) 1102 __field(u32, mask) 1103 ), 1104 TP_fast_assign( 1105 __entry->inode = inode; 1106 __entry->nlink = inode->i_nlink; 1107 __entry->mode = inode->i_mode; 1108 __entry->mask = mask; 1109 ), 1110 TP_printk("inode=%p nlink=%u mode=0%ho mask=0x%x", __entry->inode, 1111 __entry->nlink, __entry->mode, __entry->mask) 1112 ); 1113 1114 DECLARE_EVENT_CLASS(nfsd_file_gc_class, 1115 TP_PROTO( 1116 const struct nfsd_file *nf 1117 ), 1118 TP_ARGS(nf), 1119 TP_STRUCT__entry( 1120 __field(void *, nf_inode) 1121 __field(void *, nf_file) 1122 __field(int, nf_ref) 1123 __field(unsigned long, nf_flags) 1124 ), 1125 TP_fast_assign( 1126 __entry->nf_inode = nf->nf_inode; 1127 __entry->nf_file = nf->nf_file; 1128 __entry->nf_ref = refcount_read(&nf->nf_ref); 1129 __entry->nf_flags = nf->nf_flags; 1130 ), 1131 TP_printk("inode=%p ref=%d nf_flags=%s nf_file=%p", 1132 __entry->nf_inode, __entry->nf_ref, 1133 show_nf_flags(__entry->nf_flags), 1134 __entry->nf_file 1135 ) 1136 ); 1137 1138 #define DEFINE_NFSD_FILE_GC_EVENT(name) \ 1139 DEFINE_EVENT(nfsd_file_gc_class, name, \ 1140 TP_PROTO( \ 1141 const struct nfsd_file *nf \ 1142 ), \ 1143 TP_ARGS(nf)) 1144 1145 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add); 1146 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add_disposed); 1147 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del); 1148 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del_disposed); 1149 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_in_use); 1150 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_writeback); 1151 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_referenced); 1152 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_hashed); 1153 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_disposed); 1154 1155 DECLARE_EVENT_CLASS(nfsd_file_lruwalk_class, 1156 TP_PROTO( 1157 unsigned long removed, 1158 unsigned long remaining 1159 ), 1160 TP_ARGS(removed, remaining), 1161 TP_STRUCT__entry( 1162 __field(unsigned long, removed) 1163 __field(unsigned long, remaining) 1164 ), 1165 TP_fast_assign( 1166 __entry->removed = removed; 1167 __entry->remaining = remaining; 1168 ), 1169 TP_printk("%lu entries removed, %lu remaining", 1170 __entry->removed, __entry->remaining) 1171 ); 1172 1173 #define DEFINE_NFSD_FILE_LRUWALK_EVENT(name) \ 1174 DEFINE_EVENT(nfsd_file_lruwalk_class, name, \ 1175 TP_PROTO( \ 1176 unsigned long removed, \ 1177 unsigned long remaining \ 1178 ), \ 1179 TP_ARGS(removed, remaining)) 1180 1181 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed); 1182 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed); 1183 1184 #include "cache.h" 1185 1186 TRACE_DEFINE_ENUM(RC_DROPIT); 1187 TRACE_DEFINE_ENUM(RC_REPLY); 1188 TRACE_DEFINE_ENUM(RC_DOIT); 1189 1190 #define show_drc_retval(x) \ 1191 __print_symbolic(x, \ 1192 { RC_DROPIT, "DROPIT" }, \ 1193 { RC_REPLY, "REPLY" }, \ 1194 { RC_DOIT, "DOIT" }) 1195 1196 TRACE_EVENT(nfsd_drc_found, 1197 TP_PROTO( 1198 const struct nfsd_net *nn, 1199 const struct svc_rqst *rqstp, 1200 int result 1201 ), 1202 TP_ARGS(nn, rqstp, result), 1203 TP_STRUCT__entry( 1204 __field(unsigned long long, boot_time) 1205 __field(unsigned long, result) 1206 __field(u32, xid) 1207 ), 1208 TP_fast_assign( 1209 __entry->boot_time = nn->boot_time; 1210 __entry->result = result; 1211 __entry->xid = be32_to_cpu(rqstp->rq_xid); 1212 ), 1213 TP_printk("boot_time=%16llx xid=0x%08x result=%s", 1214 __entry->boot_time, __entry->xid, 1215 show_drc_retval(__entry->result)) 1216 1217 ); 1218 1219 TRACE_EVENT(nfsd_drc_mismatch, 1220 TP_PROTO( 1221 const struct nfsd_net *nn, 1222 const struct svc_cacherep *key, 1223 const struct svc_cacherep *rp 1224 ), 1225 TP_ARGS(nn, key, rp), 1226 TP_STRUCT__entry( 1227 __field(unsigned long long, boot_time) 1228 __field(u32, xid) 1229 __field(u32, cached) 1230 __field(u32, ingress) 1231 ), 1232 TP_fast_assign( 1233 __entry->boot_time = nn->boot_time; 1234 __entry->xid = be32_to_cpu(key->c_key.k_xid); 1235 __entry->cached = (__force u32)key->c_key.k_csum; 1236 __entry->ingress = (__force u32)rp->c_key.k_csum; 1237 ), 1238 TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x", 1239 __entry->boot_time, __entry->xid, __entry->cached, 1240 __entry->ingress) 1241 ); 1242 1243 TRACE_EVENT(nfsd_cb_args, 1244 TP_PROTO( 1245 const struct nfs4_client *clp, 1246 const struct nfs4_cb_conn *conn 1247 ), 1248 TP_ARGS(clp, conn), 1249 TP_STRUCT__entry( 1250 __field(u32, cl_boot) 1251 __field(u32, cl_id) 1252 __field(u32, prog) 1253 __field(u32, ident) 1254 __sockaddr(addr, conn->cb_addrlen) 1255 ), 1256 TP_fast_assign( 1257 __entry->cl_boot = clp->cl_clientid.cl_boot; 1258 __entry->cl_id = clp->cl_clientid.cl_id; 1259 __entry->prog = conn->cb_prog; 1260 __entry->ident = conn->cb_ident; 1261 __assign_sockaddr(addr, &conn->cb_addr, conn->cb_addrlen); 1262 ), 1263 TP_printk("addr=%pISpc client %08x:%08x prog=%u ident=%u", 1264 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1265 __entry->prog, __entry->ident) 1266 ); 1267 1268 TRACE_EVENT(nfsd_cb_nodelegs, 1269 TP_PROTO(const struct nfs4_client *clp), 1270 TP_ARGS(clp), 1271 TP_STRUCT__entry( 1272 __field(u32, cl_boot) 1273 __field(u32, cl_id) 1274 ), 1275 TP_fast_assign( 1276 __entry->cl_boot = clp->cl_clientid.cl_boot; 1277 __entry->cl_id = clp->cl_clientid.cl_id; 1278 ), 1279 TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) 1280 ) 1281 1282 #define show_cb_state(val) \ 1283 __print_symbolic(val, \ 1284 { NFSD4_CB_UP, "UP" }, \ 1285 { NFSD4_CB_UNKNOWN, "UNKNOWN" }, \ 1286 { NFSD4_CB_DOWN, "DOWN" }, \ 1287 { NFSD4_CB_FAULT, "FAULT"}) 1288 1289 DECLARE_EVENT_CLASS(nfsd_cb_class, 1290 TP_PROTO(const struct nfs4_client *clp), 1291 TP_ARGS(clp), 1292 TP_STRUCT__entry( 1293 __field(unsigned long, state) 1294 __field(u32, cl_boot) 1295 __field(u32, cl_id) 1296 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1297 ), 1298 TP_fast_assign( 1299 __entry->state = clp->cl_cb_state; 1300 __entry->cl_boot = clp->cl_clientid.cl_boot; 1301 __entry->cl_id = clp->cl_clientid.cl_id; 1302 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1303 clp->cl_cb_conn.cb_addrlen) 1304 ), 1305 TP_printk("addr=%pISpc client %08x:%08x state=%s", 1306 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1307 show_cb_state(__entry->state)) 1308 ); 1309 1310 #define DEFINE_NFSD_CB_EVENT(name) \ 1311 DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name, \ 1312 TP_PROTO(const struct nfs4_client *clp), \ 1313 TP_ARGS(clp)) 1314 1315 DEFINE_NFSD_CB_EVENT(state); 1316 DEFINE_NFSD_CB_EVENT(probe); 1317 DEFINE_NFSD_CB_EVENT(lost); 1318 DEFINE_NFSD_CB_EVENT(shutdown); 1319 1320 TRACE_DEFINE_ENUM(RPC_AUTH_NULL); 1321 TRACE_DEFINE_ENUM(RPC_AUTH_UNIX); 1322 TRACE_DEFINE_ENUM(RPC_AUTH_GSS); 1323 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 1324 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 1325 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 1326 1327 #define show_nfsd_authflavor(val) \ 1328 __print_symbolic(val, \ 1329 { RPC_AUTH_NULL, "none" }, \ 1330 { RPC_AUTH_UNIX, "sys" }, \ 1331 { RPC_AUTH_GSS, "gss" }, \ 1332 { RPC_AUTH_GSS_KRB5, "krb5" }, \ 1333 { RPC_AUTH_GSS_KRB5I, "krb5i" }, \ 1334 { RPC_AUTH_GSS_KRB5P, "krb5p" }) 1335 1336 TRACE_EVENT(nfsd_cb_setup, 1337 TP_PROTO(const struct nfs4_client *clp, 1338 const char *netid, 1339 rpc_authflavor_t authflavor 1340 ), 1341 TP_ARGS(clp, netid, authflavor), 1342 TP_STRUCT__entry( 1343 __field(u32, cl_boot) 1344 __field(u32, cl_id) 1345 __field(unsigned long, authflavor) 1346 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1347 __array(unsigned char, netid, 8) 1348 ), 1349 TP_fast_assign( 1350 __entry->cl_boot = clp->cl_clientid.cl_boot; 1351 __entry->cl_id = clp->cl_clientid.cl_id; 1352 strlcpy(__entry->netid, netid, sizeof(__entry->netid)); 1353 __entry->authflavor = authflavor; 1354 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1355 clp->cl_cb_conn.cb_addrlen) 1356 ), 1357 TP_printk("addr=%pISpc client %08x:%08x proto=%s flavor=%s", 1358 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1359 __entry->netid, show_nfsd_authflavor(__entry->authflavor)) 1360 ); 1361 1362 TRACE_EVENT(nfsd_cb_setup_err, 1363 TP_PROTO( 1364 const struct nfs4_client *clp, 1365 long error 1366 ), 1367 TP_ARGS(clp, error), 1368 TP_STRUCT__entry( 1369 __field(long, error) 1370 __field(u32, cl_boot) 1371 __field(u32, cl_id) 1372 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1373 ), 1374 TP_fast_assign( 1375 __entry->error = error; 1376 __entry->cl_boot = clp->cl_clientid.cl_boot; 1377 __entry->cl_id = clp->cl_clientid.cl_id; 1378 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1379 clp->cl_cb_conn.cb_addrlen) 1380 ), 1381 TP_printk("addr=%pISpc client %08x:%08x error=%ld", 1382 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1383 __entry->error) 1384 ); 1385 1386 TRACE_EVENT_CONDITION(nfsd_cb_recall, 1387 TP_PROTO( 1388 const struct nfs4_stid *stid 1389 ), 1390 TP_ARGS(stid), 1391 TP_CONDITION(stid->sc_client), 1392 TP_STRUCT__entry( 1393 __field(u32, cl_boot) 1394 __field(u32, cl_id) 1395 __field(u32, si_id) 1396 __field(u32, si_generation) 1397 __sockaddr(addr, stid->sc_client->cl_cb_conn.cb_addrlen) 1398 ), 1399 TP_fast_assign( 1400 const stateid_t *stp = &stid->sc_stateid; 1401 const struct nfs4_client *clp = stid->sc_client; 1402 1403 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 1404 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 1405 __entry->si_id = stp->si_opaque.so_id; 1406 __entry->si_generation = stp->si_generation; 1407 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1408 clp->cl_cb_conn.cb_addrlen) 1409 ), 1410 TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x", 1411 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1412 __entry->si_id, __entry->si_generation) 1413 ); 1414 1415 TRACE_EVENT(nfsd_cb_notify_lock, 1416 TP_PROTO( 1417 const struct nfs4_lockowner *lo, 1418 const struct nfsd4_blocked_lock *nbl 1419 ), 1420 TP_ARGS(lo, nbl), 1421 TP_STRUCT__entry( 1422 __field(u32, cl_boot) 1423 __field(u32, cl_id) 1424 __field(u32, fh_hash) 1425 __sockaddr(addr, lo->lo_owner.so_client->cl_cb_conn.cb_addrlen) 1426 ), 1427 TP_fast_assign( 1428 const struct nfs4_client *clp = lo->lo_owner.so_client; 1429 1430 __entry->cl_boot = clp->cl_clientid.cl_boot; 1431 __entry->cl_id = clp->cl_clientid.cl_id; 1432 __entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh); 1433 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1434 clp->cl_cb_conn.cb_addrlen) 1435 ), 1436 TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x", 1437 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1438 __entry->fh_hash) 1439 ); 1440 1441 TRACE_EVENT(nfsd_cb_offload, 1442 TP_PROTO( 1443 const struct nfs4_client *clp, 1444 const stateid_t *stp, 1445 const struct knfsd_fh *fh, 1446 u64 count, 1447 __be32 status 1448 ), 1449 TP_ARGS(clp, stp, fh, count, status), 1450 TP_STRUCT__entry( 1451 __field(u32, cl_boot) 1452 __field(u32, cl_id) 1453 __field(u32, si_id) 1454 __field(u32, si_generation) 1455 __field(u32, fh_hash) 1456 __field(int, status) 1457 __field(u64, count) 1458 __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) 1459 ), 1460 TP_fast_assign( 1461 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 1462 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 1463 __entry->si_id = stp->si_opaque.so_id; 1464 __entry->si_generation = stp->si_generation; 1465 __entry->fh_hash = knfsd_fh_hash(fh); 1466 __entry->status = be32_to_cpu(status); 1467 __entry->count = count; 1468 __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, 1469 clp->cl_cb_conn.cb_addrlen) 1470 ), 1471 TP_printk("addr=%pISpc client %08x:%08x stateid %08x:%08x fh_hash=0x%08x count=%llu status=%d", 1472 __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, 1473 __entry->si_id, __entry->si_generation, 1474 __entry->fh_hash, __entry->count, __entry->status) 1475 ); 1476 1477 DECLARE_EVENT_CLASS(nfsd_cb_done_class, 1478 TP_PROTO( 1479 const stateid_t *stp, 1480 const struct rpc_task *task 1481 ), 1482 TP_ARGS(stp, task), 1483 TP_STRUCT__entry( 1484 __field(u32, cl_boot) 1485 __field(u32, cl_id) 1486 __field(u32, si_id) 1487 __field(u32, si_generation) 1488 __field(int, status) 1489 ), 1490 TP_fast_assign( 1491 __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; 1492 __entry->cl_id = stp->si_opaque.so_clid.cl_id; 1493 __entry->si_id = stp->si_opaque.so_id; 1494 __entry->si_generation = stp->si_generation; 1495 __entry->status = task->tk_status; 1496 ), 1497 TP_printk("client %08x:%08x stateid %08x:%08x status=%d", 1498 __entry->cl_boot, __entry->cl_id, __entry->si_id, 1499 __entry->si_generation, __entry->status 1500 ) 1501 ); 1502 1503 #define DEFINE_NFSD_CB_DONE_EVENT(name) \ 1504 DEFINE_EVENT(nfsd_cb_done_class, name, \ 1505 TP_PROTO( \ 1506 const stateid_t *stp, \ 1507 const struct rpc_task *task \ 1508 ), \ 1509 TP_ARGS(stp, task)) 1510 1511 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_recall_done); 1512 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_notify_lock_done); 1513 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_layout_done); 1514 DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_offload_done); 1515 1516 #endif /* _NFSD_TRACE_H */ 1517 1518 #undef TRACE_INCLUDE_PATH 1519 #define TRACE_INCLUDE_PATH . 1520 #define TRACE_INCLUDE_FILE trace 1521 #include <trace/define_trace.h> 1522