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