1 /* 2 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com> 3 */ 4 #undef TRACE_SYSTEM 5 #define TRACE_SYSTEM nfs4 6 7 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ) 8 #define _TRACE_NFS4_H 9 10 #include <linux/tracepoint.h> 11 12 #define show_nfsv4_errors(error) \ 13 __print_symbolic(error, \ 14 { NFS4_OK, "OK" }, \ 15 /* Mapped by nfs4_stat_to_errno() */ \ 16 { -EPERM, "EPERM" }, \ 17 { -ENOENT, "ENOENT" }, \ 18 { -EIO, "EIO" }, \ 19 { -ENXIO, "ENXIO" }, \ 20 { -EACCES, "EACCES" }, \ 21 { -EEXIST, "EEXIST" }, \ 22 { -EXDEV, "EXDEV" }, \ 23 { -ENOTDIR, "ENOTDIR" }, \ 24 { -EISDIR, "EISDIR" }, \ 25 { -EFBIG, "EFBIG" }, \ 26 { -ENOSPC, "ENOSPC" }, \ 27 { -EROFS, "EROFS" }, \ 28 { -EMLINK, "EMLINK" }, \ 29 { -ENAMETOOLONG, "ENAMETOOLONG" }, \ 30 { -ENOTEMPTY, "ENOTEMPTY" }, \ 31 { -EDQUOT, "EDQUOT" }, \ 32 { -ESTALE, "ESTALE" }, \ 33 { -EBADHANDLE, "EBADHANDLE" }, \ 34 { -EBADCOOKIE, "EBADCOOKIE" }, \ 35 { -ENOTSUPP, "ENOTSUPP" }, \ 36 { -ETOOSMALL, "ETOOSMALL" }, \ 37 { -EREMOTEIO, "EREMOTEIO" }, \ 38 { -EBADTYPE, "EBADTYPE" }, \ 39 { -EAGAIN, "EAGAIN" }, \ 40 { -ELOOP, "ELOOP" }, \ 41 { -EOPNOTSUPP, "EOPNOTSUPP" }, \ 42 { -EDEADLK, "EDEADLK" }, \ 43 /* RPC errors */ \ 44 { -ENOMEM, "ENOMEM" }, \ 45 { -EKEYEXPIRED, "EKEYEXPIRED" }, \ 46 { -ETIMEDOUT, "ETIMEDOUT" }, \ 47 { -ERESTARTSYS, "ERESTARTSYS" }, \ 48 { -ECONNREFUSED, "ECONNREFUSED" }, \ 49 { -ECONNRESET, "ECONNRESET" }, \ 50 { -ENETUNREACH, "ENETUNREACH" }, \ 51 { -EHOSTUNREACH, "EHOSTUNREACH" }, \ 52 { -EHOSTDOWN, "EHOSTDOWN" }, \ 53 { -EPIPE, "EPIPE" }, \ 54 { -EPFNOSUPPORT, "EPFNOSUPPORT" }, \ 55 { -EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \ 56 /* NFSv4 native errors */ \ 57 { -NFS4ERR_ACCESS, "ACCESS" }, \ 58 { -NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \ 59 { -NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \ 60 { -NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \ 61 { -NFS4ERR_BADCHAR, "BADCHAR" }, \ 62 { -NFS4ERR_BADHANDLE, "BADHANDLE" }, \ 63 { -NFS4ERR_BADIOMODE, "BADIOMODE" }, \ 64 { -NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \ 65 { -NFS4ERR_BADLABEL, "BADLABEL" }, \ 66 { -NFS4ERR_BADNAME, "BADNAME" }, \ 67 { -NFS4ERR_BADOWNER, "BADOWNER" }, \ 68 { -NFS4ERR_BADSESSION, "BADSESSION" }, \ 69 { -NFS4ERR_BADSLOT, "BADSLOT" }, \ 70 { -NFS4ERR_BADTYPE, "BADTYPE" }, \ 71 { -NFS4ERR_BADXDR, "BADXDR" }, \ 72 { -NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \ 73 { -NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \ 74 { -NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \ 75 { -NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \ 76 { -NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \ 77 { -NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \ 78 { -NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \ 79 { -NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \ 80 { -NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \ 81 { -NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \ 82 { -NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \ 83 "CONN_NOT_BOUND_TO_SESSION" }, \ 84 { -NFS4ERR_DEADLOCK, "DEADLOCK" }, \ 85 { -NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \ 86 { -NFS4ERR_DELAY, "DELAY" }, \ 87 { -NFS4ERR_DELEG_ALREADY_WANTED, \ 88 "DELEG_ALREADY_WANTED" }, \ 89 { -NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \ 90 { -NFS4ERR_DENIED, "DENIED" }, \ 91 { -NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \ 92 { -NFS4ERR_DQUOT, "DQUOT" }, \ 93 { -NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \ 94 { -NFS4ERR_EXIST, "EXIST" }, \ 95 { -NFS4ERR_EXPIRED, "EXPIRED" }, \ 96 { -NFS4ERR_FBIG, "FBIG" }, \ 97 { -NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \ 98 { -NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \ 99 { -NFS4ERR_GRACE, "GRACE" }, \ 100 { -NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \ 101 { -NFS4ERR_INVAL, "INVAL" }, \ 102 { -NFS4ERR_IO, "IO" }, \ 103 { -NFS4ERR_ISDIR, "ISDIR" }, \ 104 { -NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \ 105 { -NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \ 106 { -NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \ 107 { -NFS4ERR_LOCKED, "LOCKED" }, \ 108 { -NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \ 109 { -NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \ 110 { -NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \ 111 { -NFS4ERR_MLINK, "MLINK" }, \ 112 { -NFS4ERR_MOVED, "MOVED" }, \ 113 { -NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \ 114 { -NFS4ERR_NOENT, "NOENT" }, \ 115 { -NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \ 116 { -NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \ 117 { -NFS4ERR_NOSPC, "NOSPC" }, \ 118 { -NFS4ERR_NOTDIR, "NOTDIR" }, \ 119 { -NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \ 120 { -NFS4ERR_NOTSUPP, "NOTSUPP" }, \ 121 { -NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \ 122 { -NFS4ERR_NOT_SAME, "NOT_SAME" }, \ 123 { -NFS4ERR_NO_GRACE, "NO_GRACE" }, \ 124 { -NFS4ERR_NXIO, "NXIO" }, \ 125 { -NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \ 126 { -NFS4ERR_OPENMODE, "OPENMODE" }, \ 127 { -NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \ 128 { -NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \ 129 { -NFS4ERR_PERM, "PERM" }, \ 130 { -NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \ 131 { -NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \ 132 { -NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \ 133 { -NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \ 134 { -NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \ 135 { -NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \ 136 { -NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \ 137 { -NFS4ERR_REP_TOO_BIG_TO_CACHE, \ 138 "REP_TOO_BIG_TO_CACHE" }, \ 139 { -NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \ 140 { -NFS4ERR_RESOURCE, "RESOURCE" }, \ 141 { -NFS4ERR_RESTOREFH, "RESTOREFH" }, \ 142 { -NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \ 143 { -NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \ 144 { -NFS4ERR_ROFS, "ROFS" }, \ 145 { -NFS4ERR_SAME, "SAME" }, \ 146 { -NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \ 147 { -NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \ 148 { -NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \ 149 { -NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \ 150 { -NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \ 151 { -NFS4ERR_STALE, "STALE" }, \ 152 { -NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \ 153 { -NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \ 154 { -NFS4ERR_SYMLINK, "SYMLINK" }, \ 155 { -NFS4ERR_TOOSMALL, "TOOSMALL" }, \ 156 { -NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \ 157 { -NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \ 158 { -NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \ 159 { -NFS4ERR_WRONGSEC, "WRONGSEC" }, \ 160 { -NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \ 161 { -NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \ 162 { -NFS4ERR_XDEV, "XDEV" }) 163 164 #define show_open_flags(flags) \ 165 __print_flags(flags, "|", \ 166 { O_CREAT, "O_CREAT" }, \ 167 { O_EXCL, "O_EXCL" }, \ 168 { O_TRUNC, "O_TRUNC" }, \ 169 { O_DIRECT, "O_DIRECT" }) 170 171 #define show_fmode_flags(mode) \ 172 __print_flags(mode, "|", \ 173 { ((__force unsigned long)FMODE_READ), "READ" }, \ 174 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \ 175 { ((__force unsigned long)FMODE_EXEC), "EXEC" }) 176 177 #define show_nfs_fattr_flags(valid) \ 178 __print_flags((unsigned long)valid, "|", \ 179 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \ 180 { NFS_ATTR_FATTR_MODE, "MODE" }, \ 181 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \ 182 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \ 183 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \ 184 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \ 185 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \ 186 { NFS_ATTR_FATTR_FSID, "FSID" }, \ 187 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \ 188 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \ 189 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \ 190 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \ 191 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \ 192 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \ 193 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" }) 194 195 DECLARE_EVENT_CLASS(nfs4_clientid_event, 196 TP_PROTO( 197 const struct nfs_client *clp, 198 int error 199 ), 200 201 TP_ARGS(clp, error), 202 203 TP_STRUCT__entry( 204 __string(dstaddr, 205 rpc_peeraddr2str(clp->cl_rpcclient, 206 RPC_DISPLAY_ADDR)) 207 __field(int, error) 208 ), 209 210 TP_fast_assign( 211 __entry->error = error; 212 __assign_str(dstaddr, 213 rpc_peeraddr2str(clp->cl_rpcclient, 214 RPC_DISPLAY_ADDR)); 215 ), 216 217 TP_printk( 218 "error=%d (%s) dstaddr=%s", 219 __entry->error, 220 show_nfsv4_errors(__entry->error), 221 __get_str(dstaddr) 222 ) 223 ); 224 #define DEFINE_NFS4_CLIENTID_EVENT(name) \ 225 DEFINE_EVENT(nfs4_clientid_event, name, \ 226 TP_PROTO( \ 227 const struct nfs_client *clp, \ 228 int error \ 229 ), \ 230 TP_ARGS(clp, error)) 231 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid); 232 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm); 233 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew); 234 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async); 235 #ifdef CONFIG_NFS_V4_1 236 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id); 237 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session); 238 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session); 239 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid); 240 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session); 241 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence); 242 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete); 243 244 #define show_nfs4_sequence_status_flags(status) \ 245 __print_flags((unsigned long)status, "|", \ 246 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \ 247 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \ 248 "CB_GSS_CONTEXTS_EXPIRING" }, \ 249 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \ 250 "CB_GSS_CONTEXTS_EXPIRED" }, \ 251 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \ 252 "EXPIRED_ALL_STATE_REVOKED" }, \ 253 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \ 254 "EXPIRED_SOME_STATE_REVOKED" }, \ 255 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \ 256 "ADMIN_STATE_REVOKED" }, \ 257 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \ 258 "RECALLABLE_STATE_REVOKED" }, \ 259 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \ 260 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \ 261 "RESTART_RECLAIM_NEEDED" }, \ 262 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \ 263 "CB_PATH_DOWN_SESSION" }, \ 264 { SEQ4_STATUS_BACKCHANNEL_FAULT, \ 265 "BACKCHANNEL_FAULT" }) 266 267 TRACE_EVENT(nfs4_sequence_done, 268 TP_PROTO( 269 const struct nfs4_session *session, 270 const struct nfs4_sequence_res *res 271 ), 272 TP_ARGS(session, res), 273 274 TP_STRUCT__entry( 275 __field(unsigned int, session) 276 __field(unsigned int, slot_nr) 277 __field(unsigned int, seq_nr) 278 __field(unsigned int, highest_slotid) 279 __field(unsigned int, target_highest_slotid) 280 __field(unsigned int, status_flags) 281 __field(int, error) 282 ), 283 284 TP_fast_assign( 285 const struct nfs4_slot *sr_slot = res->sr_slot; 286 __entry->session = nfs_session_id_hash(&session->sess_id); 287 __entry->slot_nr = sr_slot->slot_nr; 288 __entry->seq_nr = sr_slot->seq_nr; 289 __entry->highest_slotid = res->sr_highest_slotid; 290 __entry->target_highest_slotid = 291 res->sr_target_highest_slotid; 292 __entry->status_flags = res->sr_status_flags; 293 __entry->error = res->sr_status; 294 ), 295 TP_printk( 296 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u " 297 "highest_slotid=%u target_highest_slotid=%u " 298 "status_flags=%u (%s)", 299 __entry->error, 300 show_nfsv4_errors(__entry->error), 301 __entry->session, 302 __entry->slot_nr, 303 __entry->seq_nr, 304 __entry->highest_slotid, 305 __entry->target_highest_slotid, 306 __entry->status_flags, 307 show_nfs4_sequence_status_flags(__entry->status_flags) 308 ) 309 ); 310 311 struct cb_sequenceargs; 312 struct cb_sequenceres; 313 314 TRACE_EVENT(nfs4_cb_sequence, 315 TP_PROTO( 316 const struct cb_sequenceargs *args, 317 const struct cb_sequenceres *res, 318 __be32 status 319 ), 320 TP_ARGS(args, res, status), 321 322 TP_STRUCT__entry( 323 __field(unsigned int, session) 324 __field(unsigned int, slot_nr) 325 __field(unsigned int, seq_nr) 326 __field(unsigned int, highest_slotid) 327 __field(unsigned int, cachethis) 328 __field(int, error) 329 ), 330 331 TP_fast_assign( 332 __entry->session = nfs_session_id_hash(&args->csa_sessionid); 333 __entry->slot_nr = args->csa_slotid; 334 __entry->seq_nr = args->csa_sequenceid; 335 __entry->highest_slotid = args->csa_highestslotid; 336 __entry->cachethis = args->csa_cachethis; 337 __entry->error = -be32_to_cpu(status); 338 ), 339 340 TP_printk( 341 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u " 342 "highest_slotid=%u", 343 __entry->error, 344 show_nfsv4_errors(__entry->error), 345 __entry->session, 346 __entry->slot_nr, 347 __entry->seq_nr, 348 __entry->highest_slotid 349 ) 350 ); 351 #endif /* CONFIG_NFS_V4_1 */ 352 353 TRACE_EVENT(nfs4_setup_sequence, 354 TP_PROTO( 355 const struct nfs4_session *session, 356 const struct nfs4_sequence_args *args 357 ), 358 TP_ARGS(session, args), 359 360 TP_STRUCT__entry( 361 __field(unsigned int, session) 362 __field(unsigned int, slot_nr) 363 __field(unsigned int, seq_nr) 364 __field(unsigned int, highest_used_slotid) 365 ), 366 367 TP_fast_assign( 368 const struct nfs4_slot *sa_slot = args->sa_slot; 369 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0; 370 __entry->slot_nr = sa_slot->slot_nr; 371 __entry->seq_nr = sa_slot->seq_nr; 372 __entry->highest_used_slotid = 373 sa_slot->table->highest_used_slotid; 374 ), 375 TP_printk( 376 "session=0x%08x slot_nr=%u seq_nr=%u " 377 "highest_used_slotid=%u", 378 __entry->session, 379 __entry->slot_nr, 380 __entry->seq_nr, 381 __entry->highest_used_slotid 382 ) 383 ); 384 385 DECLARE_EVENT_CLASS(nfs4_open_event, 386 TP_PROTO( 387 const struct nfs_open_context *ctx, 388 int flags, 389 int error 390 ), 391 392 TP_ARGS(ctx, flags, error), 393 394 TP_STRUCT__entry( 395 __field(int, error) 396 __field(unsigned int, flags) 397 __field(unsigned int, fmode) 398 __field(dev_t, dev) 399 __field(u32, fhandle) 400 __field(u64, fileid) 401 __field(u64, dir) 402 __string(name, ctx->dentry->d_name.name) 403 __field(int, stateid_seq) 404 __field(u32, stateid_hash) 405 __field(int, openstateid_seq) 406 __field(u32, openstateid_hash) 407 ), 408 409 TP_fast_assign( 410 const struct nfs4_state *state = ctx->state; 411 const struct inode *inode = NULL; 412 413 __entry->error = error; 414 __entry->flags = flags; 415 __entry->fmode = (__force unsigned int)ctx->mode; 416 __entry->dev = ctx->dentry->d_sb->s_dev; 417 if (!IS_ERR_OR_NULL(state)) { 418 inode = state->inode; 419 __entry->stateid_seq = 420 be32_to_cpu(state->stateid.seqid); 421 __entry->stateid_hash = 422 nfs_stateid_hash(&state->stateid); 423 __entry->openstateid_seq = 424 be32_to_cpu(state->open_stateid.seqid); 425 __entry->openstateid_hash = 426 nfs_stateid_hash(&state->open_stateid); 427 } else { 428 __entry->stateid_seq = 0; 429 __entry->stateid_hash = 0; 430 __entry->openstateid_seq = 0; 431 __entry->openstateid_hash = 0; 432 } 433 if (inode != NULL) { 434 __entry->fileid = NFS_FILEID(inode); 435 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 436 } else { 437 __entry->fileid = 0; 438 __entry->fhandle = 0; 439 } 440 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent)); 441 __assign_str(name, ctx->dentry->d_name.name); 442 ), 443 444 TP_printk( 445 "error=%d (%s) flags=%d (%s) fmode=%s " 446 "fileid=%02x:%02x:%llu fhandle=0x%08x " 447 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x " 448 "openstateid=%d:0x%08x", 449 __entry->error, 450 show_nfsv4_errors(__entry->error), 451 __entry->flags, 452 show_open_flags(__entry->flags), 453 show_fmode_flags(__entry->fmode), 454 MAJOR(__entry->dev), MINOR(__entry->dev), 455 (unsigned long long)__entry->fileid, 456 __entry->fhandle, 457 MAJOR(__entry->dev), MINOR(__entry->dev), 458 (unsigned long long)__entry->dir, 459 __get_str(name), 460 __entry->stateid_seq, __entry->stateid_hash, 461 __entry->openstateid_seq, __entry->openstateid_hash 462 ) 463 ); 464 465 #define DEFINE_NFS4_OPEN_EVENT(name) \ 466 DEFINE_EVENT(nfs4_open_event, name, \ 467 TP_PROTO( \ 468 const struct nfs_open_context *ctx, \ 469 int flags, \ 470 int error \ 471 ), \ 472 TP_ARGS(ctx, flags, error)) 473 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim); 474 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired); 475 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file); 476 477 TRACE_EVENT(nfs4_cached_open, 478 TP_PROTO( 479 const struct nfs4_state *state 480 ), 481 TP_ARGS(state), 482 TP_STRUCT__entry( 483 __field(dev_t, dev) 484 __field(u32, fhandle) 485 __field(u64, fileid) 486 __field(unsigned int, fmode) 487 __field(int, stateid_seq) 488 __field(u32, stateid_hash) 489 ), 490 491 TP_fast_assign( 492 const struct inode *inode = state->inode; 493 494 __entry->dev = inode->i_sb->s_dev; 495 __entry->fileid = NFS_FILEID(inode); 496 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 497 __entry->fmode = (__force unsigned int)state->state; 498 __entry->stateid_seq = 499 be32_to_cpu(state->stateid.seqid); 500 __entry->stateid_hash = 501 nfs_stateid_hash(&state->stateid); 502 ), 503 504 TP_printk( 505 "fmode=%s fileid=%02x:%02x:%llu " 506 "fhandle=0x%08x stateid=%d:0x%08x", 507 __entry->fmode ? show_fmode_flags(__entry->fmode) : 508 "closed", 509 MAJOR(__entry->dev), MINOR(__entry->dev), 510 (unsigned long long)__entry->fileid, 511 __entry->fhandle, 512 __entry->stateid_seq, __entry->stateid_hash 513 ) 514 ); 515 516 TRACE_EVENT(nfs4_close, 517 TP_PROTO( 518 const struct nfs4_state *state, 519 const struct nfs_closeargs *args, 520 const struct nfs_closeres *res, 521 int error 522 ), 523 524 TP_ARGS(state, args, res, error), 525 526 TP_STRUCT__entry( 527 __field(dev_t, dev) 528 __field(u32, fhandle) 529 __field(u64, fileid) 530 __field(unsigned int, fmode) 531 __field(int, error) 532 __field(int, stateid_seq) 533 __field(u32, stateid_hash) 534 ), 535 536 TP_fast_assign( 537 const struct inode *inode = state->inode; 538 539 __entry->dev = inode->i_sb->s_dev; 540 __entry->fileid = NFS_FILEID(inode); 541 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 542 __entry->fmode = (__force unsigned int)state->state; 543 __entry->error = error; 544 __entry->stateid_seq = 545 be32_to_cpu(args->stateid.seqid); 546 __entry->stateid_hash = 547 nfs_stateid_hash(&args->stateid); 548 ), 549 550 TP_printk( 551 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu " 552 "fhandle=0x%08x openstateid=%d:0x%08x", 553 __entry->error, 554 show_nfsv4_errors(__entry->error), 555 __entry->fmode ? show_fmode_flags(__entry->fmode) : 556 "closed", 557 MAJOR(__entry->dev), MINOR(__entry->dev), 558 (unsigned long long)__entry->fileid, 559 __entry->fhandle, 560 __entry->stateid_seq, __entry->stateid_hash 561 ) 562 ); 563 564 #define show_lock_cmd(type) \ 565 __print_symbolic((int)type, \ 566 { F_GETLK, "GETLK" }, \ 567 { F_SETLK, "SETLK" }, \ 568 { F_SETLKW, "SETLKW" }) 569 #define show_lock_type(type) \ 570 __print_symbolic((int)type, \ 571 { F_RDLCK, "RDLCK" }, \ 572 { F_WRLCK, "WRLCK" }, \ 573 { F_UNLCK, "UNLCK" }) 574 575 DECLARE_EVENT_CLASS(nfs4_lock_event, 576 TP_PROTO( 577 const struct file_lock *request, 578 const struct nfs4_state *state, 579 int cmd, 580 int error 581 ), 582 583 TP_ARGS(request, state, cmd, error), 584 585 TP_STRUCT__entry( 586 __field(int, error) 587 __field(int, cmd) 588 __field(char, type) 589 __field(loff_t, start) 590 __field(loff_t, end) 591 __field(dev_t, dev) 592 __field(u32, fhandle) 593 __field(u64, fileid) 594 __field(int, stateid_seq) 595 __field(u32, stateid_hash) 596 ), 597 598 TP_fast_assign( 599 const struct inode *inode = state->inode; 600 601 __entry->error = error; 602 __entry->cmd = cmd; 603 __entry->type = request->fl_type; 604 __entry->start = request->fl_start; 605 __entry->end = request->fl_end; 606 __entry->dev = inode->i_sb->s_dev; 607 __entry->fileid = NFS_FILEID(inode); 608 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 609 __entry->stateid_seq = 610 be32_to_cpu(state->stateid.seqid); 611 __entry->stateid_hash = 612 nfs_stateid_hash(&state->stateid); 613 ), 614 615 TP_printk( 616 "error=%d (%s) cmd=%s:%s range=%lld:%lld " 617 "fileid=%02x:%02x:%llu fhandle=0x%08x " 618 "stateid=%d:0x%08x", 619 __entry->error, 620 show_nfsv4_errors(__entry->error), 621 show_lock_cmd(__entry->cmd), 622 show_lock_type(__entry->type), 623 (long long)__entry->start, 624 (long long)__entry->end, 625 MAJOR(__entry->dev), MINOR(__entry->dev), 626 (unsigned long long)__entry->fileid, 627 __entry->fhandle, 628 __entry->stateid_seq, __entry->stateid_hash 629 ) 630 ); 631 632 #define DEFINE_NFS4_LOCK_EVENT(name) \ 633 DEFINE_EVENT(nfs4_lock_event, name, \ 634 TP_PROTO( \ 635 const struct file_lock *request, \ 636 const struct nfs4_state *state, \ 637 int cmd, \ 638 int error \ 639 ), \ 640 TP_ARGS(request, state, cmd, error)) 641 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock); 642 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock); 643 644 TRACE_EVENT(nfs4_set_lock, 645 TP_PROTO( 646 const struct file_lock *request, 647 const struct nfs4_state *state, 648 const nfs4_stateid *lockstateid, 649 int cmd, 650 int error 651 ), 652 653 TP_ARGS(request, state, lockstateid, cmd, error), 654 655 TP_STRUCT__entry( 656 __field(int, error) 657 __field(int, cmd) 658 __field(char, type) 659 __field(loff_t, start) 660 __field(loff_t, end) 661 __field(dev_t, dev) 662 __field(u32, fhandle) 663 __field(u64, fileid) 664 __field(int, stateid_seq) 665 __field(u32, stateid_hash) 666 __field(int, lockstateid_seq) 667 __field(u32, lockstateid_hash) 668 ), 669 670 TP_fast_assign( 671 const struct inode *inode = state->inode; 672 673 __entry->error = error; 674 __entry->cmd = cmd; 675 __entry->type = request->fl_type; 676 __entry->start = request->fl_start; 677 __entry->end = request->fl_end; 678 __entry->dev = inode->i_sb->s_dev; 679 __entry->fileid = NFS_FILEID(inode); 680 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 681 __entry->stateid_seq = 682 be32_to_cpu(state->stateid.seqid); 683 __entry->stateid_hash = 684 nfs_stateid_hash(&state->stateid); 685 __entry->lockstateid_seq = 686 be32_to_cpu(lockstateid->seqid); 687 __entry->lockstateid_hash = 688 nfs_stateid_hash(lockstateid); 689 ), 690 691 TP_printk( 692 "error=%d (%s) cmd=%s:%s range=%lld:%lld " 693 "fileid=%02x:%02x:%llu fhandle=0x%08x " 694 "stateid=%d:0x%08x lockstateid=%d:0x%08x", 695 __entry->error, 696 show_nfsv4_errors(__entry->error), 697 show_lock_cmd(__entry->cmd), 698 show_lock_type(__entry->type), 699 (long long)__entry->start, 700 (long long)__entry->end, 701 MAJOR(__entry->dev), MINOR(__entry->dev), 702 (unsigned long long)__entry->fileid, 703 __entry->fhandle, 704 __entry->stateid_seq, __entry->stateid_hash, 705 __entry->lockstateid_seq, __entry->lockstateid_hash 706 ) 707 ); 708 709 DECLARE_EVENT_CLASS(nfs4_set_delegation_event, 710 TP_PROTO( 711 const struct inode *inode, 712 fmode_t fmode 713 ), 714 715 TP_ARGS(inode, fmode), 716 717 TP_STRUCT__entry( 718 __field(dev_t, dev) 719 __field(u32, fhandle) 720 __field(u64, fileid) 721 __field(unsigned int, fmode) 722 ), 723 724 TP_fast_assign( 725 __entry->dev = inode->i_sb->s_dev; 726 __entry->fileid = NFS_FILEID(inode); 727 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 728 __entry->fmode = (__force unsigned int)fmode; 729 ), 730 731 TP_printk( 732 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x", 733 show_fmode_flags(__entry->fmode), 734 MAJOR(__entry->dev), MINOR(__entry->dev), 735 (unsigned long long)__entry->fileid, 736 __entry->fhandle 737 ) 738 ); 739 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \ 740 DEFINE_EVENT(nfs4_set_delegation_event, name, \ 741 TP_PROTO( \ 742 const struct inode *inode, \ 743 fmode_t fmode \ 744 ), \ 745 TP_ARGS(inode, fmode)) 746 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation); 747 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation); 748 749 TRACE_EVENT(nfs4_delegreturn_exit, 750 TP_PROTO( 751 const struct nfs4_delegreturnargs *args, 752 const struct nfs4_delegreturnres *res, 753 int error 754 ), 755 756 TP_ARGS(args, res, error), 757 758 TP_STRUCT__entry( 759 __field(dev_t, dev) 760 __field(u32, fhandle) 761 __field(int, error) 762 __field(int, stateid_seq) 763 __field(u32, stateid_hash) 764 ), 765 766 TP_fast_assign( 767 __entry->dev = res->server->s_dev; 768 __entry->fhandle = nfs_fhandle_hash(args->fhandle); 769 __entry->error = error; 770 __entry->stateid_seq = 771 be32_to_cpu(args->stateid->seqid); 772 __entry->stateid_hash = 773 nfs_stateid_hash(args->stateid); 774 ), 775 776 TP_printk( 777 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x " 778 "stateid=%d:0x%08x", 779 __entry->error, 780 show_nfsv4_errors(__entry->error), 781 MAJOR(__entry->dev), MINOR(__entry->dev), 782 __entry->fhandle, 783 __entry->stateid_seq, __entry->stateid_hash 784 ) 785 ); 786 787 #ifdef CONFIG_NFS_V4_1 788 DECLARE_EVENT_CLASS(nfs4_test_stateid_event, 789 TP_PROTO( 790 const struct nfs4_state *state, 791 const struct nfs4_lock_state *lsp, 792 int error 793 ), 794 795 TP_ARGS(state, lsp, error), 796 797 TP_STRUCT__entry( 798 __field(int, error) 799 __field(dev_t, dev) 800 __field(u32, fhandle) 801 __field(u64, fileid) 802 __field(int, stateid_seq) 803 __field(u32, stateid_hash) 804 ), 805 806 TP_fast_assign( 807 const struct inode *inode = state->inode; 808 809 __entry->error = error; 810 __entry->dev = inode->i_sb->s_dev; 811 __entry->fileid = NFS_FILEID(inode); 812 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 813 __entry->stateid_seq = 814 be32_to_cpu(state->stateid.seqid); 815 __entry->stateid_hash = 816 nfs_stateid_hash(&state->stateid); 817 ), 818 819 TP_printk( 820 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 821 "stateid=%d:0x%08x", 822 __entry->error, 823 show_nfsv4_errors(__entry->error), 824 MAJOR(__entry->dev), MINOR(__entry->dev), 825 (unsigned long long)__entry->fileid, 826 __entry->fhandle, 827 __entry->stateid_seq, __entry->stateid_hash 828 ) 829 ); 830 831 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \ 832 DEFINE_EVENT(nfs4_test_stateid_event, name, \ 833 TP_PROTO( \ 834 const struct nfs4_state *state, \ 835 const struct nfs4_lock_state *lsp, \ 836 int error \ 837 ), \ 838 TP_ARGS(state, lsp, error)) 839 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid); 840 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid); 841 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid); 842 #endif /* CONFIG_NFS_V4_1 */ 843 844 DECLARE_EVENT_CLASS(nfs4_lookup_event, 845 TP_PROTO( 846 const struct inode *dir, 847 const struct qstr *name, 848 int error 849 ), 850 851 TP_ARGS(dir, name, error), 852 853 TP_STRUCT__entry( 854 __field(dev_t, dev) 855 __field(int, error) 856 __field(u64, dir) 857 __string(name, name->name) 858 ), 859 860 TP_fast_assign( 861 __entry->dev = dir->i_sb->s_dev; 862 __entry->dir = NFS_FILEID(dir); 863 __entry->error = error; 864 __assign_str(name, name->name); 865 ), 866 867 TP_printk( 868 "error=%d (%s) name=%02x:%02x:%llu/%s", 869 __entry->error, 870 show_nfsv4_errors(__entry->error), 871 MAJOR(__entry->dev), MINOR(__entry->dev), 872 (unsigned long long)__entry->dir, 873 __get_str(name) 874 ) 875 ); 876 877 #define DEFINE_NFS4_LOOKUP_EVENT(name) \ 878 DEFINE_EVENT(nfs4_lookup_event, name, \ 879 TP_PROTO( \ 880 const struct inode *dir, \ 881 const struct qstr *name, \ 882 int error \ 883 ), \ 884 TP_ARGS(dir, name, error)) 885 886 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup); 887 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink); 888 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir); 889 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod); 890 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove); 891 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations); 892 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo); 893 894 TRACE_EVENT(nfs4_lookupp, 895 TP_PROTO( 896 const struct inode *inode, 897 int error 898 ), 899 900 TP_ARGS(inode, error), 901 902 TP_STRUCT__entry( 903 __field(dev_t, dev) 904 __field(u64, ino) 905 __field(int, error) 906 ), 907 908 TP_fast_assign( 909 __entry->dev = inode->i_sb->s_dev; 910 __entry->ino = NFS_FILEID(inode); 911 __entry->error = error; 912 ), 913 914 TP_printk( 915 "error=%d (%s) inode=%02x:%02x:%llu", 916 __entry->error, 917 show_nfsv4_errors(__entry->error), 918 MAJOR(__entry->dev), MINOR(__entry->dev), 919 (unsigned long long)__entry->ino 920 ) 921 ); 922 923 TRACE_EVENT(nfs4_rename, 924 TP_PROTO( 925 const struct inode *olddir, 926 const struct qstr *oldname, 927 const struct inode *newdir, 928 const struct qstr *newname, 929 int error 930 ), 931 932 TP_ARGS(olddir, oldname, newdir, newname, error), 933 934 TP_STRUCT__entry( 935 __field(dev_t, dev) 936 __field(int, error) 937 __field(u64, olddir) 938 __string(oldname, oldname->name) 939 __field(u64, newdir) 940 __string(newname, newname->name) 941 ), 942 943 TP_fast_assign( 944 __entry->dev = olddir->i_sb->s_dev; 945 __entry->olddir = NFS_FILEID(olddir); 946 __entry->newdir = NFS_FILEID(newdir); 947 __entry->error = error; 948 __assign_str(oldname, oldname->name); 949 __assign_str(newname, newname->name); 950 ), 951 952 TP_printk( 953 "error=%d (%s) oldname=%02x:%02x:%llu/%s " 954 "newname=%02x:%02x:%llu/%s", 955 __entry->error, 956 show_nfsv4_errors(__entry->error), 957 MAJOR(__entry->dev), MINOR(__entry->dev), 958 (unsigned long long)__entry->olddir, 959 __get_str(oldname), 960 MAJOR(__entry->dev), MINOR(__entry->dev), 961 (unsigned long long)__entry->newdir, 962 __get_str(newname) 963 ) 964 ); 965 966 DECLARE_EVENT_CLASS(nfs4_inode_event, 967 TP_PROTO( 968 const struct inode *inode, 969 int error 970 ), 971 972 TP_ARGS(inode, error), 973 974 TP_STRUCT__entry( 975 __field(dev_t, dev) 976 __field(u32, fhandle) 977 __field(u64, fileid) 978 __field(int, error) 979 ), 980 981 TP_fast_assign( 982 __entry->dev = inode->i_sb->s_dev; 983 __entry->fileid = NFS_FILEID(inode); 984 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 985 __entry->error = error; 986 ), 987 988 TP_printk( 989 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x", 990 __entry->error, 991 show_nfsv4_errors(__entry->error), 992 MAJOR(__entry->dev), MINOR(__entry->dev), 993 (unsigned long long)__entry->fileid, 994 __entry->fhandle 995 ) 996 ); 997 998 #define DEFINE_NFS4_INODE_EVENT(name) \ 999 DEFINE_EVENT(nfs4_inode_event, name, \ 1000 TP_PROTO( \ 1001 const struct inode *inode, \ 1002 int error \ 1003 ), \ 1004 TP_ARGS(inode, error)) 1005 1006 DEFINE_NFS4_INODE_EVENT(nfs4_access); 1007 DEFINE_NFS4_INODE_EVENT(nfs4_readlink); 1008 DEFINE_NFS4_INODE_EVENT(nfs4_readdir); 1009 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl); 1010 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl); 1011 #ifdef CONFIG_NFS_V4_SECURITY_LABEL 1012 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label); 1013 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label); 1014 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ 1015 1016 DECLARE_EVENT_CLASS(nfs4_inode_stateid_event, 1017 TP_PROTO( 1018 const struct inode *inode, 1019 const nfs4_stateid *stateid, 1020 int error 1021 ), 1022 1023 TP_ARGS(inode, stateid, error), 1024 1025 TP_STRUCT__entry( 1026 __field(dev_t, dev) 1027 __field(u32, fhandle) 1028 __field(u64, fileid) 1029 __field(int, error) 1030 __field(int, stateid_seq) 1031 __field(u32, stateid_hash) 1032 ), 1033 1034 TP_fast_assign( 1035 __entry->dev = inode->i_sb->s_dev; 1036 __entry->fileid = NFS_FILEID(inode); 1037 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1038 __entry->error = error; 1039 __entry->stateid_seq = 1040 be32_to_cpu(stateid->seqid); 1041 __entry->stateid_hash = 1042 nfs_stateid_hash(stateid); 1043 ), 1044 1045 TP_printk( 1046 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1047 "stateid=%d:0x%08x", 1048 __entry->error, 1049 show_nfsv4_errors(__entry->error), 1050 MAJOR(__entry->dev), MINOR(__entry->dev), 1051 (unsigned long long)__entry->fileid, 1052 __entry->fhandle, 1053 __entry->stateid_seq, __entry->stateid_hash 1054 ) 1055 ); 1056 1057 #define DEFINE_NFS4_INODE_STATEID_EVENT(name) \ 1058 DEFINE_EVENT(nfs4_inode_stateid_event, name, \ 1059 TP_PROTO( \ 1060 const struct inode *inode, \ 1061 const nfs4_stateid *stateid, \ 1062 int error \ 1063 ), \ 1064 TP_ARGS(inode, stateid, error)) 1065 1066 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr); 1067 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn); 1068 1069 DECLARE_EVENT_CLASS(nfs4_getattr_event, 1070 TP_PROTO( 1071 const struct nfs_server *server, 1072 const struct nfs_fh *fhandle, 1073 const struct nfs_fattr *fattr, 1074 int error 1075 ), 1076 1077 TP_ARGS(server, fhandle, fattr, error), 1078 1079 TP_STRUCT__entry( 1080 __field(dev_t, dev) 1081 __field(u32, fhandle) 1082 __field(u64, fileid) 1083 __field(unsigned int, valid) 1084 __field(int, error) 1085 ), 1086 1087 TP_fast_assign( 1088 __entry->dev = server->s_dev; 1089 __entry->valid = fattr->valid; 1090 __entry->fhandle = nfs_fhandle_hash(fhandle); 1091 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0; 1092 __entry->error = error; 1093 ), 1094 1095 TP_printk( 1096 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1097 "valid=%s", 1098 __entry->error, 1099 show_nfsv4_errors(__entry->error), 1100 MAJOR(__entry->dev), MINOR(__entry->dev), 1101 (unsigned long long)__entry->fileid, 1102 __entry->fhandle, 1103 show_nfs_fattr_flags(__entry->valid) 1104 ) 1105 ); 1106 1107 #define DEFINE_NFS4_GETATTR_EVENT(name) \ 1108 DEFINE_EVENT(nfs4_getattr_event, name, \ 1109 TP_PROTO( \ 1110 const struct nfs_server *server, \ 1111 const struct nfs_fh *fhandle, \ 1112 const struct nfs_fattr *fattr, \ 1113 int error \ 1114 ), \ 1115 TP_ARGS(server, fhandle, fattr, error)) 1116 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr); 1117 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root); 1118 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo); 1119 1120 DECLARE_EVENT_CLASS(nfs4_inode_callback_event, 1121 TP_PROTO( 1122 const struct nfs_client *clp, 1123 const struct nfs_fh *fhandle, 1124 const struct inode *inode, 1125 int error 1126 ), 1127 1128 TP_ARGS(clp, fhandle, inode, error), 1129 1130 TP_STRUCT__entry( 1131 __field(int, error) 1132 __field(dev_t, dev) 1133 __field(u32, fhandle) 1134 __field(u64, fileid) 1135 __string(dstaddr, clp ? 1136 rpc_peeraddr2str(clp->cl_rpcclient, 1137 RPC_DISPLAY_ADDR) : "unknown") 1138 ), 1139 1140 TP_fast_assign( 1141 __entry->error = error; 1142 __entry->fhandle = nfs_fhandle_hash(fhandle); 1143 if (inode != NULL) { 1144 __entry->fileid = NFS_FILEID(inode); 1145 __entry->dev = inode->i_sb->s_dev; 1146 } else { 1147 __entry->fileid = 0; 1148 __entry->dev = 0; 1149 } 1150 __assign_str(dstaddr, clp ? 1151 rpc_peeraddr2str(clp->cl_rpcclient, 1152 RPC_DISPLAY_ADDR) : "unknown") 1153 ), 1154 1155 TP_printk( 1156 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1157 "dstaddr=%s", 1158 __entry->error, 1159 show_nfsv4_errors(__entry->error), 1160 MAJOR(__entry->dev), MINOR(__entry->dev), 1161 (unsigned long long)__entry->fileid, 1162 __entry->fhandle, 1163 __get_str(dstaddr) 1164 ) 1165 ); 1166 1167 #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \ 1168 DEFINE_EVENT(nfs4_inode_callback_event, name, \ 1169 TP_PROTO( \ 1170 const struct nfs_client *clp, \ 1171 const struct nfs_fh *fhandle, \ 1172 const struct inode *inode, \ 1173 int error \ 1174 ), \ 1175 TP_ARGS(clp, fhandle, inode, error)) 1176 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr); 1177 1178 DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event, 1179 TP_PROTO( 1180 const struct nfs_client *clp, 1181 const struct nfs_fh *fhandle, 1182 const struct inode *inode, 1183 const nfs4_stateid *stateid, 1184 int error 1185 ), 1186 1187 TP_ARGS(clp, fhandle, inode, stateid, error), 1188 1189 TP_STRUCT__entry( 1190 __field(int, error) 1191 __field(dev_t, dev) 1192 __field(u32, fhandle) 1193 __field(u64, fileid) 1194 __string(dstaddr, clp ? 1195 rpc_peeraddr2str(clp->cl_rpcclient, 1196 RPC_DISPLAY_ADDR) : "unknown") 1197 __field(int, stateid_seq) 1198 __field(u32, stateid_hash) 1199 ), 1200 1201 TP_fast_assign( 1202 __entry->error = error; 1203 __entry->fhandle = nfs_fhandle_hash(fhandle); 1204 if (inode != NULL) { 1205 __entry->fileid = NFS_FILEID(inode); 1206 __entry->dev = inode->i_sb->s_dev; 1207 } else { 1208 __entry->fileid = 0; 1209 __entry->dev = 0; 1210 } 1211 __assign_str(dstaddr, clp ? 1212 rpc_peeraddr2str(clp->cl_rpcclient, 1213 RPC_DISPLAY_ADDR) : "unknown") 1214 __entry->stateid_seq = 1215 be32_to_cpu(stateid->seqid); 1216 __entry->stateid_hash = 1217 nfs_stateid_hash(stateid); 1218 ), 1219 1220 TP_printk( 1221 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1222 "stateid=%d:0x%08x dstaddr=%s", 1223 __entry->error, 1224 show_nfsv4_errors(__entry->error), 1225 MAJOR(__entry->dev), MINOR(__entry->dev), 1226 (unsigned long long)__entry->fileid, 1227 __entry->fhandle, 1228 __entry->stateid_seq, __entry->stateid_hash, 1229 __get_str(dstaddr) 1230 ) 1231 ); 1232 1233 #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \ 1234 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \ 1235 TP_PROTO( \ 1236 const struct nfs_client *clp, \ 1237 const struct nfs_fh *fhandle, \ 1238 const struct inode *inode, \ 1239 const nfs4_stateid *stateid, \ 1240 int error \ 1241 ), \ 1242 TP_ARGS(clp, fhandle, inode, stateid, error)) 1243 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall); 1244 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file); 1245 1246 DECLARE_EVENT_CLASS(nfs4_idmap_event, 1247 TP_PROTO( 1248 const char *name, 1249 int len, 1250 u32 id, 1251 int error 1252 ), 1253 1254 TP_ARGS(name, len, id, error), 1255 1256 TP_STRUCT__entry( 1257 __field(int, error) 1258 __field(u32, id) 1259 __dynamic_array(char, name, len > 0 ? len + 1 : 1) 1260 ), 1261 1262 TP_fast_assign( 1263 if (len < 0) 1264 len = 0; 1265 __entry->error = error < 0 ? error : 0; 1266 __entry->id = id; 1267 memcpy(__get_str(name), name, len); 1268 __get_str(name)[len] = 0; 1269 ), 1270 1271 TP_printk( 1272 "error=%d id=%u name=%s", 1273 __entry->error, 1274 __entry->id, 1275 __get_str(name) 1276 ) 1277 ); 1278 #define DEFINE_NFS4_IDMAP_EVENT(name) \ 1279 DEFINE_EVENT(nfs4_idmap_event, name, \ 1280 TP_PROTO( \ 1281 const char *name, \ 1282 int len, \ 1283 u32 id, \ 1284 int error \ 1285 ), \ 1286 TP_ARGS(name, len, id, error)) 1287 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid); 1288 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid); 1289 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name); 1290 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group); 1291 1292 DECLARE_EVENT_CLASS(nfs4_read_event, 1293 TP_PROTO( 1294 const struct nfs_pgio_header *hdr, 1295 int error 1296 ), 1297 1298 TP_ARGS(hdr, error), 1299 1300 TP_STRUCT__entry( 1301 __field(dev_t, dev) 1302 __field(u32, fhandle) 1303 __field(u64, fileid) 1304 __field(loff_t, offset) 1305 __field(size_t, count) 1306 __field(int, error) 1307 __field(int, stateid_seq) 1308 __field(u32, stateid_hash) 1309 ), 1310 1311 TP_fast_assign( 1312 const struct inode *inode = hdr->inode; 1313 const struct nfs4_state *state = 1314 hdr->args.context->state; 1315 __entry->dev = inode->i_sb->s_dev; 1316 __entry->fileid = NFS_FILEID(inode); 1317 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1318 __entry->offset = hdr->args.offset; 1319 __entry->count = hdr->args.count; 1320 __entry->error = error; 1321 __entry->stateid_seq = 1322 be32_to_cpu(state->stateid.seqid); 1323 __entry->stateid_hash = 1324 nfs_stateid_hash(&state->stateid); 1325 ), 1326 1327 TP_printk( 1328 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1329 "offset=%lld count=%zu stateid=%d:0x%08x", 1330 __entry->error, 1331 show_nfsv4_errors(__entry->error), 1332 MAJOR(__entry->dev), MINOR(__entry->dev), 1333 (unsigned long long)__entry->fileid, 1334 __entry->fhandle, 1335 (long long)__entry->offset, 1336 __entry->count, 1337 __entry->stateid_seq, __entry->stateid_hash 1338 ) 1339 ); 1340 #define DEFINE_NFS4_READ_EVENT(name) \ 1341 DEFINE_EVENT(nfs4_read_event, name, \ 1342 TP_PROTO( \ 1343 const struct nfs_pgio_header *hdr, \ 1344 int error \ 1345 ), \ 1346 TP_ARGS(hdr, error)) 1347 DEFINE_NFS4_READ_EVENT(nfs4_read); 1348 #ifdef CONFIG_NFS_V4_1 1349 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read); 1350 #endif /* CONFIG_NFS_V4_1 */ 1351 1352 DECLARE_EVENT_CLASS(nfs4_write_event, 1353 TP_PROTO( 1354 const struct nfs_pgio_header *hdr, 1355 int error 1356 ), 1357 1358 TP_ARGS(hdr, error), 1359 1360 TP_STRUCT__entry( 1361 __field(dev_t, dev) 1362 __field(u32, fhandle) 1363 __field(u64, fileid) 1364 __field(loff_t, offset) 1365 __field(size_t, count) 1366 __field(int, error) 1367 __field(int, stateid_seq) 1368 __field(u32, stateid_hash) 1369 ), 1370 1371 TP_fast_assign( 1372 const struct inode *inode = hdr->inode; 1373 const struct nfs4_state *state = 1374 hdr->args.context->state; 1375 __entry->dev = inode->i_sb->s_dev; 1376 __entry->fileid = NFS_FILEID(inode); 1377 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1378 __entry->offset = hdr->args.offset; 1379 __entry->count = hdr->args.count; 1380 __entry->error = error; 1381 __entry->stateid_seq = 1382 be32_to_cpu(state->stateid.seqid); 1383 __entry->stateid_hash = 1384 nfs_stateid_hash(&state->stateid); 1385 ), 1386 1387 TP_printk( 1388 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1389 "offset=%lld count=%zu stateid=%d:0x%08x", 1390 __entry->error, 1391 show_nfsv4_errors(__entry->error), 1392 MAJOR(__entry->dev), MINOR(__entry->dev), 1393 (unsigned long long)__entry->fileid, 1394 __entry->fhandle, 1395 (long long)__entry->offset, 1396 __entry->count, 1397 __entry->stateid_seq, __entry->stateid_hash 1398 ) 1399 ); 1400 1401 #define DEFINE_NFS4_WRITE_EVENT(name) \ 1402 DEFINE_EVENT(nfs4_write_event, name, \ 1403 TP_PROTO( \ 1404 const struct nfs_pgio_header *hdr, \ 1405 int error \ 1406 ), \ 1407 TP_ARGS(hdr, error)) 1408 DEFINE_NFS4_WRITE_EVENT(nfs4_write); 1409 #ifdef CONFIG_NFS_V4_1 1410 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write); 1411 #endif /* CONFIG_NFS_V4_1 */ 1412 1413 DECLARE_EVENT_CLASS(nfs4_commit_event, 1414 TP_PROTO( 1415 const struct nfs_commit_data *data, 1416 int error 1417 ), 1418 1419 TP_ARGS(data, error), 1420 1421 TP_STRUCT__entry( 1422 __field(dev_t, dev) 1423 __field(u32, fhandle) 1424 __field(u64, fileid) 1425 __field(loff_t, offset) 1426 __field(size_t, count) 1427 __field(int, error) 1428 ), 1429 1430 TP_fast_assign( 1431 const struct inode *inode = data->inode; 1432 __entry->dev = inode->i_sb->s_dev; 1433 __entry->fileid = NFS_FILEID(inode); 1434 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1435 __entry->offset = data->args.offset; 1436 __entry->count = data->args.count; 1437 __entry->error = error; 1438 ), 1439 1440 TP_printk( 1441 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1442 "offset=%lld count=%zu", 1443 __entry->error, 1444 show_nfsv4_errors(__entry->error), 1445 MAJOR(__entry->dev), MINOR(__entry->dev), 1446 (unsigned long long)__entry->fileid, 1447 __entry->fhandle, 1448 (long long)__entry->offset, 1449 __entry->count 1450 ) 1451 ); 1452 #define DEFINE_NFS4_COMMIT_EVENT(name) \ 1453 DEFINE_EVENT(nfs4_commit_event, name, \ 1454 TP_PROTO( \ 1455 const struct nfs_commit_data *data, \ 1456 int error \ 1457 ), \ 1458 TP_ARGS(data, error)) 1459 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit); 1460 #ifdef CONFIG_NFS_V4_1 1461 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds); 1462 1463 #define show_pnfs_iomode(iomode) \ 1464 __print_symbolic(iomode, \ 1465 { IOMODE_READ, "READ" }, \ 1466 { IOMODE_RW, "RW" }, \ 1467 { IOMODE_ANY, "ANY" }) 1468 1469 TRACE_EVENT(nfs4_layoutget, 1470 TP_PROTO( 1471 const struct nfs_open_context *ctx, 1472 const struct pnfs_layout_range *args, 1473 const struct pnfs_layout_range *res, 1474 const nfs4_stateid *layout_stateid, 1475 int error 1476 ), 1477 1478 TP_ARGS(ctx, args, res, layout_stateid, error), 1479 1480 TP_STRUCT__entry( 1481 __field(dev_t, dev) 1482 __field(u32, fhandle) 1483 __field(u64, fileid) 1484 __field(u32, iomode) 1485 __field(u64, offset) 1486 __field(u64, count) 1487 __field(int, error) 1488 __field(int, stateid_seq) 1489 __field(u32, stateid_hash) 1490 __field(int, layoutstateid_seq) 1491 __field(u32, layoutstateid_hash) 1492 ), 1493 1494 TP_fast_assign( 1495 const struct inode *inode = d_inode(ctx->dentry); 1496 const struct nfs4_state *state = ctx->state; 1497 __entry->dev = inode->i_sb->s_dev; 1498 __entry->fileid = NFS_FILEID(inode); 1499 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1500 __entry->iomode = args->iomode; 1501 __entry->offset = args->offset; 1502 __entry->count = args->length; 1503 __entry->error = error; 1504 __entry->stateid_seq = 1505 be32_to_cpu(state->stateid.seqid); 1506 __entry->stateid_hash = 1507 nfs_stateid_hash(&state->stateid); 1508 if (!error) { 1509 __entry->layoutstateid_seq = 1510 be32_to_cpu(layout_stateid->seqid); 1511 __entry->layoutstateid_hash = 1512 nfs_stateid_hash(layout_stateid); 1513 } else { 1514 __entry->layoutstateid_seq = 0; 1515 __entry->layoutstateid_hash = 0; 1516 } 1517 ), 1518 1519 TP_printk( 1520 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1521 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x " 1522 "layoutstateid=%d:0x%08x", 1523 __entry->error, 1524 show_nfsv4_errors(__entry->error), 1525 MAJOR(__entry->dev), MINOR(__entry->dev), 1526 (unsigned long long)__entry->fileid, 1527 __entry->fhandle, 1528 show_pnfs_iomode(__entry->iomode), 1529 (unsigned long long)__entry->offset, 1530 (unsigned long long)__entry->count, 1531 __entry->stateid_seq, __entry->stateid_hash, 1532 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1533 ) 1534 ); 1535 1536 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit); 1537 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn); 1538 DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close); 1539 1540 #define show_pnfs_update_layout_reason(reason) \ 1541 __print_symbolic(reason, \ 1542 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \ 1543 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \ 1544 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \ 1545 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \ 1546 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \ 1547 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \ 1548 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \ 1549 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \ 1550 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \ 1551 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \ 1552 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \ 1553 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \ 1554 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }) 1555 1556 TRACE_EVENT(pnfs_update_layout, 1557 TP_PROTO(struct inode *inode, 1558 loff_t pos, 1559 u64 count, 1560 enum pnfs_iomode iomode, 1561 struct pnfs_layout_hdr *lo, 1562 struct pnfs_layout_segment *lseg, 1563 enum pnfs_update_layout_reason reason 1564 ), 1565 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason), 1566 TP_STRUCT__entry( 1567 __field(dev_t, dev) 1568 __field(u64, fileid) 1569 __field(u32, fhandle) 1570 __field(loff_t, pos) 1571 __field(u64, count) 1572 __field(enum pnfs_iomode, iomode) 1573 __field(int, layoutstateid_seq) 1574 __field(u32, layoutstateid_hash) 1575 __field(long, lseg) 1576 __field(enum pnfs_update_layout_reason, reason) 1577 ), 1578 TP_fast_assign( 1579 __entry->dev = inode->i_sb->s_dev; 1580 __entry->fileid = NFS_FILEID(inode); 1581 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1582 __entry->pos = pos; 1583 __entry->count = count; 1584 __entry->iomode = iomode; 1585 __entry->reason = reason; 1586 if (lo != NULL) { 1587 __entry->layoutstateid_seq = 1588 be32_to_cpu(lo->plh_stateid.seqid); 1589 __entry->layoutstateid_hash = 1590 nfs_stateid_hash(&lo->plh_stateid); 1591 } else { 1592 __entry->layoutstateid_seq = 0; 1593 __entry->layoutstateid_hash = 0; 1594 } 1595 __entry->lseg = (long)lseg; 1596 ), 1597 TP_printk( 1598 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1599 "iomode=%s pos=%llu count=%llu " 1600 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)", 1601 MAJOR(__entry->dev), MINOR(__entry->dev), 1602 (unsigned long long)__entry->fileid, 1603 __entry->fhandle, 1604 show_pnfs_iomode(__entry->iomode), 1605 (unsigned long long)__entry->pos, 1606 (unsigned long long)__entry->count, 1607 __entry->layoutstateid_seq, __entry->layoutstateid_hash, 1608 __entry->lseg, 1609 show_pnfs_update_layout_reason(__entry->reason) 1610 ) 1611 ); 1612 1613 #endif /* CONFIG_NFS_V4_1 */ 1614 1615 #endif /* _TRACE_NFS4_H */ 1616 1617 #undef TRACE_INCLUDE_PATH 1618 #define TRACE_INCLUDE_PATH . 1619 #define TRACE_INCLUDE_FILE nfs4trace 1620 /* This part must be outside protection */ 1621 #include <trace/define_trace.h> 1622