linux/fs/nfs/nfs4trace.h

1613 lines
43 KiB
C
Raw Normal View History

License cleanup: add SPDX GPL-2.0 license identifier to files with no license Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 17:07:57 +03:00
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM nfs4
#if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_NFS4_H
#include <linux/tracepoint.h>
#define show_nfsv4_errors(error) \
__print_symbolic(error, \
{ NFS4_OK, "OK" }, \
/* Mapped by nfs4_stat_to_errno() */ \
{ -EPERM, "EPERM" }, \
{ -ENOENT, "ENOENT" }, \
{ -EIO, "EIO" }, \
{ -ENXIO, "ENXIO" }, \
{ -EACCES, "EACCES" }, \
{ -EEXIST, "EEXIST" }, \
{ -EXDEV, "EXDEV" }, \
{ -ENOTDIR, "ENOTDIR" }, \
{ -EISDIR, "EISDIR" }, \
{ -EFBIG, "EFBIG" }, \
{ -ENOSPC, "ENOSPC" }, \
{ -EROFS, "EROFS" }, \
{ -EMLINK, "EMLINK" }, \
{ -ENAMETOOLONG, "ENAMETOOLONG" }, \
{ -ENOTEMPTY, "ENOTEMPTY" }, \
{ -EDQUOT, "EDQUOT" }, \
{ -ESTALE, "ESTALE" }, \
{ -EBADHANDLE, "EBADHANDLE" }, \
{ -EBADCOOKIE, "EBADCOOKIE" }, \
{ -ENOTSUPP, "ENOTSUPP" }, \
{ -ETOOSMALL, "ETOOSMALL" }, \
{ -EREMOTEIO, "EREMOTEIO" }, \
{ -EBADTYPE, "EBADTYPE" }, \
{ -EAGAIN, "EAGAIN" }, \
{ -ELOOP, "ELOOP" }, \
{ -EOPNOTSUPP, "EOPNOTSUPP" }, \
{ -EDEADLK, "EDEADLK" }, \
/* RPC errors */ \
{ -ENOMEM, "ENOMEM" }, \
{ -EKEYEXPIRED, "EKEYEXPIRED" }, \
{ -ETIMEDOUT, "ETIMEDOUT" }, \
{ -ERESTARTSYS, "ERESTARTSYS" }, \
{ -ECONNREFUSED, "ECONNREFUSED" }, \
{ -ECONNRESET, "ECONNRESET" }, \
{ -ENETUNREACH, "ENETUNREACH" }, \
{ -EHOSTUNREACH, "EHOSTUNREACH" }, \
{ -EHOSTDOWN, "EHOSTDOWN" }, \
{ -EPIPE, "EPIPE" }, \
{ -EPFNOSUPPORT, "EPFNOSUPPORT" }, \
{ -EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
/* NFSv4 native errors */ \
{ -NFS4ERR_ACCESS, "ACCESS" }, \
{ -NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
{ -NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
{ -NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
{ -NFS4ERR_BADCHAR, "BADCHAR" }, \
{ -NFS4ERR_BADHANDLE, "BADHANDLE" }, \
{ -NFS4ERR_BADIOMODE, "BADIOMODE" }, \
{ -NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
{ -NFS4ERR_BADLABEL, "BADLABEL" }, \
{ -NFS4ERR_BADNAME, "BADNAME" }, \
{ -NFS4ERR_BADOWNER, "BADOWNER" }, \
{ -NFS4ERR_BADSESSION, "BADSESSION" }, \
{ -NFS4ERR_BADSLOT, "BADSLOT" }, \
{ -NFS4ERR_BADTYPE, "BADTYPE" }, \
{ -NFS4ERR_BADXDR, "BADXDR" }, \
{ -NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
{ -NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
{ -NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
{ -NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
{ -NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
{ -NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
{ -NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
{ -NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
{ -NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
{ -NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
{ -NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
"CONN_NOT_BOUND_TO_SESSION" }, \
{ -NFS4ERR_DEADLOCK, "DEADLOCK" }, \
{ -NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
{ -NFS4ERR_DELAY, "DELAY" }, \
{ -NFS4ERR_DELEG_ALREADY_WANTED, \
"DELEG_ALREADY_WANTED" }, \
{ -NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
{ -NFS4ERR_DENIED, "DENIED" }, \
{ -NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
{ -NFS4ERR_DQUOT, "DQUOT" }, \
{ -NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
{ -NFS4ERR_EXIST, "EXIST" }, \
{ -NFS4ERR_EXPIRED, "EXPIRED" }, \
{ -NFS4ERR_FBIG, "FBIG" }, \
{ -NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
{ -NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
{ -NFS4ERR_GRACE, "GRACE" }, \
{ -NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
{ -NFS4ERR_INVAL, "INVAL" }, \
{ -NFS4ERR_IO, "IO" }, \
{ -NFS4ERR_ISDIR, "ISDIR" }, \
{ -NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
{ -NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
{ -NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
{ -NFS4ERR_LOCKED, "LOCKED" }, \
{ -NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
{ -NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
{ -NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
{ -NFS4ERR_MLINK, "MLINK" }, \
{ -NFS4ERR_MOVED, "MOVED" }, \
{ -NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
{ -NFS4ERR_NOENT, "NOENT" }, \
{ -NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
{ -NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
{ -NFS4ERR_NOSPC, "NOSPC" }, \
{ -NFS4ERR_NOTDIR, "NOTDIR" }, \
{ -NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
{ -NFS4ERR_NOTSUPP, "NOTSUPP" }, \
{ -NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
{ -NFS4ERR_NOT_SAME, "NOT_SAME" }, \
{ -NFS4ERR_NO_GRACE, "NO_GRACE" }, \
{ -NFS4ERR_NXIO, "NXIO" }, \
{ -NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
{ -NFS4ERR_OPENMODE, "OPENMODE" }, \
{ -NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
{ -NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
{ -NFS4ERR_PERM, "PERM" }, \
{ -NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
{ -NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
{ -NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
{ -NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
{ -NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
{ -NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
{ -NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
{ -NFS4ERR_REP_TOO_BIG_TO_CACHE, \
"REP_TOO_BIG_TO_CACHE" }, \
{ -NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
{ -NFS4ERR_RESOURCE, "RESOURCE" }, \
{ -NFS4ERR_RESTOREFH, "RESTOREFH" }, \
{ -NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
{ -NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
{ -NFS4ERR_ROFS, "ROFS" }, \
{ -NFS4ERR_SAME, "SAME" }, \
{ -NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
{ -NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
{ -NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
{ -NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
{ -NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
{ -NFS4ERR_STALE, "STALE" }, \
{ -NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
{ -NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
{ -NFS4ERR_SYMLINK, "SYMLINK" }, \
{ -NFS4ERR_TOOSMALL, "TOOSMALL" }, \
{ -NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
{ -NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
{ -NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
{ -NFS4ERR_WRONGSEC, "WRONGSEC" }, \
{ -NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
{ -NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
{ -NFS4ERR_XDEV, "XDEV" })
#define show_open_flags(flags) \
__print_flags(flags, "|", \
{ O_CREAT, "O_CREAT" }, \
{ O_EXCL, "O_EXCL" }, \
{ O_TRUNC, "O_TRUNC" }, \
{ O_DIRECT, "O_DIRECT" })
#define show_fmode_flags(mode) \
__print_flags(mode, "|", \
{ ((__force unsigned long)FMODE_READ), "READ" }, \
{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
#define show_nfs_fattr_flags(valid) \
__print_flags((unsigned long)valid, "|", \
{ NFS_ATTR_FATTR_TYPE, "TYPE" }, \
{ NFS_ATTR_FATTR_MODE, "MODE" }, \
{ NFS_ATTR_FATTR_NLINK, "NLINK" }, \
{ NFS_ATTR_FATTR_OWNER, "OWNER" }, \
{ NFS_ATTR_FATTR_GROUP, "GROUP" }, \
{ NFS_ATTR_FATTR_RDEV, "RDEV" }, \
{ NFS_ATTR_FATTR_SIZE, "SIZE" }, \
{ NFS_ATTR_FATTR_FSID, "FSID" }, \
{ NFS_ATTR_FATTR_FILEID, "FILEID" }, \
{ NFS_ATTR_FATTR_ATIME, "ATIME" }, \
{ NFS_ATTR_FATTR_MTIME, "MTIME" }, \
{ NFS_ATTR_FATTR_CTIME, "CTIME" }, \
{ NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
{ NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
{ NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
DECLARE_EVENT_CLASS(nfs4_clientid_event,
TP_PROTO(
const struct nfs_client *clp,
int error
),
TP_ARGS(clp, error),
TP_STRUCT__entry(
__string(dstaddr, clp->cl_hostname)
__field(int, error)
),
TP_fast_assign(
__entry->error = error;
__assign_str(dstaddr, clp->cl_hostname);
),
TP_printk(
"error=%d (%s) dstaddr=%s",
__entry->error,
show_nfsv4_errors(__entry->error),
__get_str(dstaddr)
)
);
#define DEFINE_NFS4_CLIENTID_EVENT(name) \
DEFINE_EVENT(nfs4_clientid_event, name, \
TP_PROTO( \
const struct nfs_client *clp, \
int error \
), \
TP_ARGS(clp, error))
DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
#ifdef CONFIG_NFS_V4_1
DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
#define show_nfs4_sequence_status_flags(status) \
__print_flags((unsigned long)status, "|", \
{ SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
{ SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
"CB_GSS_CONTEXTS_EXPIRING" }, \
{ SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
"CB_GSS_CONTEXTS_EXPIRED" }, \
{ SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
"EXPIRED_ALL_STATE_REVOKED" }, \
{ SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
"EXPIRED_SOME_STATE_REVOKED" }, \
{ SEQ4_STATUS_ADMIN_STATE_REVOKED, \
"ADMIN_STATE_REVOKED" }, \
{ SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
"RECALLABLE_STATE_REVOKED" }, \
{ SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
{ SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
"RESTART_RECLAIM_NEEDED" }, \
{ SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
"CB_PATH_DOWN_SESSION" }, \
{ SEQ4_STATUS_BACKCHANNEL_FAULT, \
"BACKCHANNEL_FAULT" })
TRACE_EVENT(nfs4_sequence_done,
TP_PROTO(
const struct nfs4_session *session,
const struct nfs4_sequence_res *res
),
TP_ARGS(session, res),
TP_STRUCT__entry(
__field(unsigned int, session)
__field(unsigned int, slot_nr)
__field(unsigned int, seq_nr)
__field(unsigned int, highest_slotid)
__field(unsigned int, target_highest_slotid)
__field(unsigned int, status_flags)
__field(int, error)
),
TP_fast_assign(
const struct nfs4_slot *sr_slot = res->sr_slot;
__entry->session = nfs_session_id_hash(&session->sess_id);
__entry->slot_nr = sr_slot->slot_nr;
__entry->seq_nr = sr_slot->seq_nr;
__entry->highest_slotid = res->sr_highest_slotid;
__entry->target_highest_slotid =
res->sr_target_highest_slotid;
__entry->status_flags = res->sr_status_flags;
__entry->error = res->sr_status;
),
TP_printk(
"error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
"highest_slotid=%u target_highest_slotid=%u "
"status_flags=%u (%s)",
__entry->error,
show_nfsv4_errors(__entry->error),
__entry->session,
__entry->slot_nr,
__entry->seq_nr,
__entry->highest_slotid,
__entry->target_highest_slotid,
__entry->status_flags,
show_nfs4_sequence_status_flags(__entry->status_flags)
)
);
struct cb_sequenceargs;
struct cb_sequenceres;
TRACE_EVENT(nfs4_cb_sequence,
TP_PROTO(
const struct cb_sequenceargs *args,
const struct cb_sequenceres *res,
__be32 status
),
TP_ARGS(args, res, status),
TP_STRUCT__entry(
__field(unsigned int, session)
__field(unsigned int, slot_nr)
__field(unsigned int, seq_nr)
__field(unsigned int, highest_slotid)
__field(unsigned int, cachethis)
__field(int, error)
),
TP_fast_assign(
__entry->session = nfs_session_id_hash(&args->csa_sessionid);
__entry->slot_nr = args->csa_slotid;
__entry->seq_nr = args->csa_sequenceid;
__entry->highest_slotid = args->csa_highestslotid;
__entry->cachethis = args->csa_cachethis;
__entry->error = -be32_to_cpu(status);
),
TP_printk(
"error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
"highest_slotid=%u",
__entry->error,
show_nfsv4_errors(__entry->error),
__entry->session,
__entry->slot_nr,
__entry->seq_nr,
__entry->highest_slotid
)
);
#endif /* CONFIG_NFS_V4_1 */
TRACE_EVENT(nfs4_setup_sequence,
TP_PROTO(
const struct nfs4_session *session,
const struct nfs4_sequence_args *args
),
TP_ARGS(session, args),
TP_STRUCT__entry(
__field(unsigned int, session)
__field(unsigned int, slot_nr)
__field(unsigned int, seq_nr)
__field(unsigned int, highest_used_slotid)
),
TP_fast_assign(
const struct nfs4_slot *sa_slot = args->sa_slot;
__entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
__entry->slot_nr = sa_slot->slot_nr;
__entry->seq_nr = sa_slot->seq_nr;
__entry->highest_used_slotid =
sa_slot->table->highest_used_slotid;
),
TP_printk(
"session=0x%08x slot_nr=%u seq_nr=%u "
"highest_used_slotid=%u",
__entry->session,
__entry->slot_nr,
__entry->seq_nr,
__entry->highest_used_slotid
)
);
DECLARE_EVENT_CLASS(nfs4_open_event,
TP_PROTO(
const struct nfs_open_context *ctx,
int flags,
int error
),
TP_ARGS(ctx, flags, error),
TP_STRUCT__entry(
__field(int, error)
__field(unsigned int, flags)
__field(unsigned int, fmode)
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(u64, dir)
__string(name, ctx->dentry->d_name.name)
__field(int, stateid_seq)
__field(u32, stateid_hash)
__field(int, openstateid_seq)
__field(u32, openstateid_hash)
),
TP_fast_assign(
const struct nfs4_state *state = ctx->state;
const struct inode *inode = NULL;
__entry->error = error;
__entry->flags = flags;
__entry->fmode = (__force unsigned int)ctx->mode;
__entry->dev = ctx->dentry->d_sb->s_dev;
if (!IS_ERR_OR_NULL(state)) {
inode = state->inode;
__entry->stateid_seq =
be32_to_cpu(state->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&state->stateid);
__entry->openstateid_seq =
be32_to_cpu(state->open_stateid.seqid);
__entry->openstateid_hash =
nfs_stateid_hash(&state->open_stateid);
} else {
__entry->stateid_seq = 0;
__entry->stateid_hash = 0;
__entry->openstateid_seq = 0;
__entry->openstateid_hash = 0;
}
if (inode != NULL) {
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
} else {
__entry->fileid = 0;
__entry->fhandle = 0;
}
__entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
__assign_str(name, ctx->dentry->d_name.name);
),
TP_printk(
"error=%d (%s) flags=%d (%s) fmode=%s "
"fileid=%02x:%02x:%llu fhandle=0x%08x "
"name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
"openstateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
__entry->flags,
show_open_flags(__entry->flags),
show_fmode_flags(__entry->fmode),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->dir,
__get_str(name),
__entry->stateid_seq, __entry->stateid_hash,
__entry->openstateid_seq, __entry->openstateid_hash
)
);
#define DEFINE_NFS4_OPEN_EVENT(name) \
DEFINE_EVENT(nfs4_open_event, name, \
TP_PROTO( \
const struct nfs_open_context *ctx, \
int flags, \
int error \
), \
TP_ARGS(ctx, flags, error))
DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
TRACE_EVENT(nfs4_cached_open,
TP_PROTO(
const struct nfs4_state *state
),
TP_ARGS(state),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(unsigned int, fmode)
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
const struct inode *inode = state->inode;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->fmode = (__force unsigned int)state->state;
__entry->stateid_seq =
be32_to_cpu(state->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&state->stateid);
),
TP_printk(
"fmode=%s fileid=%02x:%02x:%llu "
"fhandle=0x%08x stateid=%d:0x%08x",
__entry->fmode ? show_fmode_flags(__entry->fmode) :
"closed",
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash
)
);
TRACE_EVENT(nfs4_close,
TP_PROTO(
const struct nfs4_state *state,
const struct nfs_closeargs *args,
const struct nfs_closeres *res,
int error
),
TP_ARGS(state, args, res, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(unsigned int, fmode)
__field(int, error)
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
const struct inode *inode = state->inode;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->fmode = (__force unsigned int)state->state;
__entry->error = error;
__entry->stateid_seq =
be32_to_cpu(args->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&args->stateid);
),
TP_printk(
"error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
"fhandle=0x%08x openstateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
__entry->fmode ? show_fmode_flags(__entry->fmode) :
"closed",
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash
)
);
#define show_lock_cmd(type) \
__print_symbolic((int)type, \
{ F_GETLK, "GETLK" }, \
{ F_SETLK, "SETLK" }, \
{ F_SETLKW, "SETLKW" })
#define show_lock_type(type) \
__print_symbolic((int)type, \
{ F_RDLCK, "RDLCK" }, \
{ F_WRLCK, "WRLCK" }, \
{ F_UNLCK, "UNLCK" })
DECLARE_EVENT_CLASS(nfs4_lock_event,
TP_PROTO(
const struct file_lock *request,
const struct nfs4_state *state,
int cmd,
int error
),
TP_ARGS(request, state, cmd, error),
TP_STRUCT__entry(
__field(int, error)
__field(int, cmd)
__field(char, type)
__field(loff_t, start)
__field(loff_t, end)
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
const struct inode *inode = state->inode;
__entry->error = error;
__entry->cmd = cmd;
__entry->type = request->fl_type;
__entry->start = request->fl_start;
__entry->end = request->fl_end;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->stateid_seq =
be32_to_cpu(state->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&state->stateid);
),
TP_printk(
"error=%d (%s) cmd=%s:%s range=%lld:%lld "
"fileid=%02x:%02x:%llu fhandle=0x%08x "
"stateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
show_lock_cmd(__entry->cmd),
show_lock_type(__entry->type),
(long long)__entry->start,
(long long)__entry->end,
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash
)
);
#define DEFINE_NFS4_LOCK_EVENT(name) \
DEFINE_EVENT(nfs4_lock_event, name, \
TP_PROTO( \
const struct file_lock *request, \
const struct nfs4_state *state, \
int cmd, \
int error \
), \
TP_ARGS(request, state, cmd, error))
DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
TRACE_EVENT(nfs4_set_lock,
TP_PROTO(
const struct file_lock *request,
const struct nfs4_state *state,
const nfs4_stateid *lockstateid,
int cmd,
int error
),
TP_ARGS(request, state, lockstateid, cmd, error),
TP_STRUCT__entry(
__field(int, error)
__field(int, cmd)
__field(char, type)
__field(loff_t, start)
__field(loff_t, end)
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(int, stateid_seq)
__field(u32, stateid_hash)
__field(int, lockstateid_seq)
__field(u32, lockstateid_hash)
),
TP_fast_assign(
const struct inode *inode = state->inode;
__entry->error = error;
__entry->cmd = cmd;
__entry->type = request->fl_type;
__entry->start = request->fl_start;
__entry->end = request->fl_end;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->stateid_seq =
be32_to_cpu(state->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&state->stateid);
__entry->lockstateid_seq =
be32_to_cpu(lockstateid->seqid);
__entry->lockstateid_hash =
nfs_stateid_hash(lockstateid);
),
TP_printk(
"error=%d (%s) cmd=%s:%s range=%lld:%lld "
"fileid=%02x:%02x:%llu fhandle=0x%08x "
"stateid=%d:0x%08x lockstateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
show_lock_cmd(__entry->cmd),
show_lock_type(__entry->type),
(long long)__entry->start,
(long long)__entry->end,
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash,
__entry->lockstateid_seq, __entry->lockstateid_hash
)
);
DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
TP_PROTO(
const struct inode *inode,
fmode_t fmode
),
TP_ARGS(inode, fmode),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(unsigned int, fmode)
),
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->fmode = (__force unsigned int)fmode;
),
TP_printk(
"fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
show_fmode_flags(__entry->fmode),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle
)
);
#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
DEFINE_EVENT(nfs4_set_delegation_event, name, \
TP_PROTO( \
const struct inode *inode, \
fmode_t fmode \
), \
TP_ARGS(inode, fmode))
DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
TRACE_EVENT(nfs4_delegreturn_exit,
TP_PROTO(
const struct nfs4_delegreturnargs *args,
const struct nfs4_delegreturnres *res,
int error
),
TP_ARGS(args, res, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(int, error)
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
__entry->dev = res->server->s_dev;
__entry->fhandle = nfs_fhandle_hash(args->fhandle);
__entry->error = error;
__entry->stateid_seq =
be32_to_cpu(args->stateid->seqid);
__entry->stateid_hash =
nfs_stateid_hash(args->stateid);
),
TP_printk(
"error=%d (%s) dev=%02x:%02x fhandle=0x%08x "
"stateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash
)
);
#ifdef CONFIG_NFS_V4_1
DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
TP_PROTO(
const struct nfs4_state *state,
const struct nfs4_lock_state *lsp,
int error
),
TP_ARGS(state, lsp, error),
TP_STRUCT__entry(
__field(int, error)
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
const struct inode *inode = state->inode;
__entry->error = error;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->stateid_seq =
be32_to_cpu(state->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&state->stateid);
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"stateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash
)
);
#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
DEFINE_EVENT(nfs4_test_stateid_event, name, \
TP_PROTO( \
const struct nfs4_state *state, \
const struct nfs4_lock_state *lsp, \
int error \
), \
TP_ARGS(state, lsp, error))
DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
#endif /* CONFIG_NFS_V4_1 */
DECLARE_EVENT_CLASS(nfs4_lookup_event,
TP_PROTO(
const struct inode *dir,
const struct qstr *name,
int error
),
TP_ARGS(dir, name, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(int, error)
__field(u64, dir)
__string(name, name->name)
),
TP_fast_assign(
__entry->dev = dir->i_sb->s_dev;
__entry->dir = NFS_FILEID(dir);
__entry->error = error;
__assign_str(name, name->name);
),
TP_printk(
"error=%d (%s) name=%02x:%02x:%llu/%s",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->dir,
__get_str(name)
)
);
#define DEFINE_NFS4_LOOKUP_EVENT(name) \
DEFINE_EVENT(nfs4_lookup_event, name, \
TP_PROTO( \
const struct inode *dir, \
const struct qstr *name, \
int error \
), \
TP_ARGS(dir, name, error))
DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
TRACE_EVENT(nfs4_lookupp,
TP_PROTO(
const struct inode *inode,
int error
),
TP_ARGS(inode, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u64, ino)
__field(int, error)
),
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->ino = NFS_FILEID(inode);
__entry->error = error;
),
TP_printk(
"error=%d (%s) inode=%02x:%02x:%llu",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->ino
)
);
TRACE_EVENT(nfs4_rename,
TP_PROTO(
const struct inode *olddir,
const struct qstr *oldname,
const struct inode *newdir,
const struct qstr *newname,
int error
),
TP_ARGS(olddir, oldname, newdir, newname, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(int, error)
__field(u64, olddir)
__string(oldname, oldname->name)
__field(u64, newdir)
__string(newname, newname->name)
),
TP_fast_assign(
__entry->dev = olddir->i_sb->s_dev;
__entry->olddir = NFS_FILEID(olddir);
__entry->newdir = NFS_FILEID(newdir);
__entry->error = error;
__assign_str(oldname, oldname->name);
__assign_str(newname, newname->name);
),
TP_printk(
"error=%d (%s) oldname=%02x:%02x:%llu/%s "
"newname=%02x:%02x:%llu/%s",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->olddir,
__get_str(oldname),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->newdir,
__get_str(newname)
)
);
DECLARE_EVENT_CLASS(nfs4_inode_event,
TP_PROTO(
const struct inode *inode,
int error
),
TP_ARGS(inode, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(int, error)
),
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->error = error;
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle
)
);
#define DEFINE_NFS4_INODE_EVENT(name) \
DEFINE_EVENT(nfs4_inode_event, name, \
TP_PROTO( \
const struct inode *inode, \
int error \
), \
TP_ARGS(inode, error))
DEFINE_NFS4_INODE_EVENT(nfs4_access);
DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
TP_PROTO(
const struct inode *inode,
const nfs4_stateid *stateid,
int error
),
TP_ARGS(inode, stateid, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(int, error)
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->error = error;
__entry->stateid_seq =
be32_to_cpu(stateid->seqid);
__entry->stateid_hash =
nfs_stateid_hash(stateid);
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"stateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash
)
);
#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
DEFINE_EVENT(nfs4_inode_stateid_event, name, \
TP_PROTO( \
const struct inode *inode, \
const nfs4_stateid *stateid, \
int error \
), \
TP_ARGS(inode, stateid, error))
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
DECLARE_EVENT_CLASS(nfs4_getattr_event,
TP_PROTO(
const struct nfs_server *server,
const struct nfs_fh *fhandle,
const struct nfs_fattr *fattr,
int error
),
TP_ARGS(server, fhandle, fattr, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(unsigned int, valid)
__field(int, error)
),
TP_fast_assign(
__entry->dev = server->s_dev;
__entry->valid = fattr->valid;
__entry->fhandle = nfs_fhandle_hash(fhandle);
__entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
__entry->error = error;
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"valid=%s",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
show_nfs_fattr_flags(__entry->valid)
)
);
#define DEFINE_NFS4_GETATTR_EVENT(name) \
DEFINE_EVENT(nfs4_getattr_event, name, \
TP_PROTO( \
const struct nfs_server *server, \
const struct nfs_fh *fhandle, \
const struct nfs_fattr *fattr, \
int error \
), \
TP_ARGS(server, fhandle, fattr, error))
DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
TP_PROTO(
const struct nfs_client *clp,
const struct nfs_fh *fhandle,
const struct inode *inode,
int error
),
TP_ARGS(clp, fhandle, inode, error),
TP_STRUCT__entry(
__field(int, error)
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__string(dstaddr, clp ? clp->cl_hostname : "unknown")
),
TP_fast_assign(
__entry->error = error;
__entry->fhandle = nfs_fhandle_hash(fhandle);
if (inode != NULL) {
__entry->fileid = NFS_FILEID(inode);
__entry->dev = inode->i_sb->s_dev;
} else {
__entry->fileid = 0;
__entry->dev = 0;
}
__assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"dstaddr=%s",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__get_str(dstaddr)
)
);
#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
DEFINE_EVENT(nfs4_inode_callback_event, name, \
TP_PROTO( \
const struct nfs_client *clp, \
const struct nfs_fh *fhandle, \
const struct inode *inode, \
int error \
), \
TP_ARGS(clp, fhandle, inode, error))
DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
TP_PROTO(
const struct nfs_client *clp,
const struct nfs_fh *fhandle,
const struct inode *inode,
const nfs4_stateid *stateid,
int error
),
TP_ARGS(clp, fhandle, inode, stateid, error),
TP_STRUCT__entry(
__field(int, error)
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__string(dstaddr, clp ? clp->cl_hostname : "unknown")
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
__entry->error = error;
__entry->fhandle = nfs_fhandle_hash(fhandle);
if (!IS_ERR_OR_NULL(inode)) {
__entry->fileid = NFS_FILEID(inode);
__entry->dev = inode->i_sb->s_dev;
} else {
__entry->fileid = 0;
__entry->dev = 0;
}
__assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
__entry->stateid_seq =
be32_to_cpu(stateid->seqid);
__entry->stateid_hash =
nfs_stateid_hash(stateid);
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"stateid=%d:0x%08x dstaddr=%s",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
__entry->stateid_seq, __entry->stateid_hash,
__get_str(dstaddr)
)
);
#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
TP_PROTO( \
const struct nfs_client *clp, \
const struct nfs_fh *fhandle, \
const struct inode *inode, \
const nfs4_stateid *stateid, \
int error \
), \
TP_ARGS(clp, fhandle, inode, stateid, error))
DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
DECLARE_EVENT_CLASS(nfs4_idmap_event,
TP_PROTO(
const char *name,
int len,
u32 id,
int error
),
TP_ARGS(name, len, id, error),
TP_STRUCT__entry(
__field(int, error)
__field(u32, id)
__dynamic_array(char, name, len > 0 ? len + 1 : 1)
),
TP_fast_assign(
if (len < 0)
len = 0;
__entry->error = error < 0 ? error : 0;
__entry->id = id;
memcpy(__get_str(name), name, len);
__get_str(name)[len] = 0;
),
TP_printk(
"error=%d id=%u name=%s",
__entry->error,
__entry->id,
__get_str(name)
)
);
#define DEFINE_NFS4_IDMAP_EVENT(name) \
DEFINE_EVENT(nfs4_idmap_event, name, \
TP_PROTO( \
const char *name, \
int len, \
u32 id, \
int error \
), \
TP_ARGS(name, len, id, error))
DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
DECLARE_EVENT_CLASS(nfs4_read_event,
TP_PROTO(
const struct nfs_pgio_header *hdr,
int error
),
TP_ARGS(hdr, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(loff_t, offset)
__field(size_t, count)
__field(int, error)
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
const struct inode *inode = hdr->inode;
const struct nfs4_state *state =
hdr->args.context->state;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->offset = hdr->args.offset;
__entry->count = hdr->args.count;
__entry->error = error;
__entry->stateid_seq =
be32_to_cpu(state->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&state->stateid);
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"offset=%lld count=%zu stateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
(long long)__entry->offset,
__entry->count,
__entry->stateid_seq, __entry->stateid_hash
)
);
#define DEFINE_NFS4_READ_EVENT(name) \
DEFINE_EVENT(nfs4_read_event, name, \
TP_PROTO( \
const struct nfs_pgio_header *hdr, \
int error \
), \
TP_ARGS(hdr, error))
DEFINE_NFS4_READ_EVENT(nfs4_read);
#ifdef CONFIG_NFS_V4_1
DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
#endif /* CONFIG_NFS_V4_1 */
DECLARE_EVENT_CLASS(nfs4_write_event,
TP_PROTO(
const struct nfs_pgio_header *hdr,
int error
),
TP_ARGS(hdr, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(loff_t, offset)
__field(size_t, count)
__field(int, error)
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
TP_fast_assign(
const struct inode *inode = hdr->inode;
const struct nfs4_state *state =
hdr->args.context->state;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->offset = hdr->args.offset;
__entry->count = hdr->args.count;
__entry->error = error;
__entry->stateid_seq =
be32_to_cpu(state->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&state->stateid);
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"offset=%lld count=%zu stateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
(long long)__entry->offset,
__entry->count,
__entry->stateid_seq, __entry->stateid_hash
)
);
#define DEFINE_NFS4_WRITE_EVENT(name) \
DEFINE_EVENT(nfs4_write_event, name, \
TP_PROTO( \
const struct nfs_pgio_header *hdr, \
int error \
), \
TP_ARGS(hdr, error))
DEFINE_NFS4_WRITE_EVENT(nfs4_write);
#ifdef CONFIG_NFS_V4_1
DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
#endif /* CONFIG_NFS_V4_1 */
DECLARE_EVENT_CLASS(nfs4_commit_event,
TP_PROTO(
const struct nfs_commit_data *data,
int error
),
TP_ARGS(data, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(loff_t, offset)
__field(size_t, count)
__field(int, error)
),
TP_fast_assign(
const struct inode *inode = data->inode;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->offset = data->args.offset;
__entry->count = data->args.count;
__entry->error = error;
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"offset=%lld count=%zu",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
(long long)__entry->offset,
__entry->count
)
);
#define DEFINE_NFS4_COMMIT_EVENT(name) \
DEFINE_EVENT(nfs4_commit_event, name, \
TP_PROTO( \
const struct nfs_commit_data *data, \
int error \
), \
TP_ARGS(data, error))
DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
#ifdef CONFIG_NFS_V4_1
DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
#define show_pnfs_iomode(iomode) \
__print_symbolic(iomode, \
{ IOMODE_READ, "READ" }, \
{ IOMODE_RW, "RW" }, \
{ IOMODE_ANY, "ANY" })
TRACE_EVENT(nfs4_layoutget,
TP_PROTO(
const struct nfs_open_context *ctx,
const struct pnfs_layout_range *args,
const struct pnfs_layout_range *res,
const nfs4_stateid *layout_stateid,
int error
),
TP_ARGS(ctx, args, res, layout_stateid, error),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__field(u32, iomode)
__field(u64, offset)
__field(u64, count)
__field(int, error)
__field(int, stateid_seq)
__field(u32, stateid_hash)
__field(int, layoutstateid_seq)
__field(u32, layoutstateid_hash)
),
TP_fast_assign(
const struct inode *inode = d_inode(ctx->dentry);
const struct nfs4_state *state = ctx->state;
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->iomode = args->iomode;
__entry->offset = args->offset;
__entry->count = args->length;
__entry->error = error;
__entry->stateid_seq =
be32_to_cpu(state->stateid.seqid);
__entry->stateid_hash =
nfs_stateid_hash(&state->stateid);
if (!error) {
__entry->layoutstateid_seq =
be32_to_cpu(layout_stateid->seqid);
__entry->layoutstateid_hash =
nfs_stateid_hash(layout_stateid);
} else {
__entry->layoutstateid_seq = 0;
__entry->layoutstateid_hash = 0;
}
),
TP_printk(
"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
"layoutstateid=%d:0x%08x",
__entry->error,
show_nfsv4_errors(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
show_pnfs_iomode(__entry->iomode),
(unsigned long long)__entry->offset,
(unsigned long long)__entry->count,
__entry->stateid_seq, __entry->stateid_hash,
__entry->layoutstateid_seq, __entry->layoutstateid_hash
)
);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
#define show_pnfs_update_layout_reason(reason) \
__print_symbolic(reason, \
{ PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
{ PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
{ PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
{ PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
{ PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
{ PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
{ PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
{ PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
{ PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
{ PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
pnfs: rework LAYOUTGET retry handling There are several problems in the way a stateid is selected for a LAYOUTGET operation: We pick a stateid to use in the RPC prepare op, but that makes it difficult to serialize LAYOUTGETs that use the open stateid. That serialization is done in pnfs_update_layout, which occurs well before the rpc_prepare operation. Between those two events, the i_lock is dropped and reacquired. pnfs_update_layout can find that the list has lsegs in it and not do any serialization, but then later pnfs_choose_layoutget_stateid ends up choosing the open stateid. This patch changes the client to select the stateid to use in the LAYOUTGET earlier, when we're searching for a usable layout segment. This way we can do it all while holding the i_lock the first time, and ensure that we serialize any LAYOUTGET call that uses a non-layout stateid. This also means a rework of how LAYOUTGET replies are handled, as we must now get the latest stateid if we want to retransmit in response to a retryable error. Most of those errors boil down to the fact that the layout state has changed in some fashion. Thus, what we really want to do is to re-search for a layout when it fails with a retryable error, so that we can avoid reissuing the RPC at all if possible. While the LAYOUTGET RPC is async, the initiating thread always waits for it to complete, so it's effectively synchronous anyway. Currently, when we need to retry a LAYOUTGET because of an error, we drive that retry via the rpc state machine. This means that once the call has been submitted, it runs until it completes. So, we must move the error handling for this RPC out of the rpc_call_done operation and into the caller. In order to handle errors like NFS4ERR_DELAY properly, we must also pass a pointer to the sliding timeout, which is now moved to the stack in pnfs_update_layout. The complicating errors are -NFS4ERR_RECALLCONFLICT and -NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give up and return NULL back to the caller. So, there is some special handling for those errors to ensure that the layers driving the retries can handle that appropriately. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-05-17 19:28:47 +03:00
{ PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
{ PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
{ PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" })
TRACE_EVENT(pnfs_update_layout,
TP_PROTO(struct inode *inode,
loff_t pos,
u64 count,
enum pnfs_iomode iomode,
struct pnfs_layout_hdr *lo,
pnfs: rework LAYOUTGET retry handling There are several problems in the way a stateid is selected for a LAYOUTGET operation: We pick a stateid to use in the RPC prepare op, but that makes it difficult to serialize LAYOUTGETs that use the open stateid. That serialization is done in pnfs_update_layout, which occurs well before the rpc_prepare operation. Between those two events, the i_lock is dropped and reacquired. pnfs_update_layout can find that the list has lsegs in it and not do any serialization, but then later pnfs_choose_layoutget_stateid ends up choosing the open stateid. This patch changes the client to select the stateid to use in the LAYOUTGET earlier, when we're searching for a usable layout segment. This way we can do it all while holding the i_lock the first time, and ensure that we serialize any LAYOUTGET call that uses a non-layout stateid. This also means a rework of how LAYOUTGET replies are handled, as we must now get the latest stateid if we want to retransmit in response to a retryable error. Most of those errors boil down to the fact that the layout state has changed in some fashion. Thus, what we really want to do is to re-search for a layout when it fails with a retryable error, so that we can avoid reissuing the RPC at all if possible. While the LAYOUTGET RPC is async, the initiating thread always waits for it to complete, so it's effectively synchronous anyway. Currently, when we need to retry a LAYOUTGET because of an error, we drive that retry via the rpc state machine. This means that once the call has been submitted, it runs until it completes. So, we must move the error handling for this RPC out of the rpc_call_done operation and into the caller. In order to handle errors like NFS4ERR_DELAY properly, we must also pass a pointer to the sliding timeout, which is now moved to the stack in pnfs_update_layout. The complicating errors are -NFS4ERR_RECALLCONFLICT and -NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give up and return NULL back to the caller. So, there is some special handling for those errors to ensure that the layers driving the retries can handle that appropriately. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-05-17 19:28:47 +03:00
struct pnfs_layout_segment *lseg,
enum pnfs_update_layout_reason reason
),
pnfs: rework LAYOUTGET retry handling There are several problems in the way a stateid is selected for a LAYOUTGET operation: We pick a stateid to use in the RPC prepare op, but that makes it difficult to serialize LAYOUTGETs that use the open stateid. That serialization is done in pnfs_update_layout, which occurs well before the rpc_prepare operation. Between those two events, the i_lock is dropped and reacquired. pnfs_update_layout can find that the list has lsegs in it and not do any serialization, but then later pnfs_choose_layoutget_stateid ends up choosing the open stateid. This patch changes the client to select the stateid to use in the LAYOUTGET earlier, when we're searching for a usable layout segment. This way we can do it all while holding the i_lock the first time, and ensure that we serialize any LAYOUTGET call that uses a non-layout stateid. This also means a rework of how LAYOUTGET replies are handled, as we must now get the latest stateid if we want to retransmit in response to a retryable error. Most of those errors boil down to the fact that the layout state has changed in some fashion. Thus, what we really want to do is to re-search for a layout when it fails with a retryable error, so that we can avoid reissuing the RPC at all if possible. While the LAYOUTGET RPC is async, the initiating thread always waits for it to complete, so it's effectively synchronous anyway. Currently, when we need to retry a LAYOUTGET because of an error, we drive that retry via the rpc state machine. This means that once the call has been submitted, it runs until it completes. So, we must move the error handling for this RPC out of the rpc_call_done operation and into the caller. In order to handle errors like NFS4ERR_DELAY properly, we must also pass a pointer to the sliding timeout, which is now moved to the stack in pnfs_update_layout. The complicating errors are -NFS4ERR_RECALLCONFLICT and -NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give up and return NULL back to the caller. So, there is some special handling for those errors to ensure that the layers driving the retries can handle that appropriately. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-05-17 19:28:47 +03:00
TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(u64, fileid)
__field(u32, fhandle)
__field(loff_t, pos)
__field(u64, count)
__field(enum pnfs_iomode, iomode)
__field(int, layoutstateid_seq)
__field(u32, layoutstateid_hash)
pnfs: rework LAYOUTGET retry handling There are several problems in the way a stateid is selected for a LAYOUTGET operation: We pick a stateid to use in the RPC prepare op, but that makes it difficult to serialize LAYOUTGETs that use the open stateid. That serialization is done in pnfs_update_layout, which occurs well before the rpc_prepare operation. Between those two events, the i_lock is dropped and reacquired. pnfs_update_layout can find that the list has lsegs in it and not do any serialization, but then later pnfs_choose_layoutget_stateid ends up choosing the open stateid. This patch changes the client to select the stateid to use in the LAYOUTGET earlier, when we're searching for a usable layout segment. This way we can do it all while holding the i_lock the first time, and ensure that we serialize any LAYOUTGET call that uses a non-layout stateid. This also means a rework of how LAYOUTGET replies are handled, as we must now get the latest stateid if we want to retransmit in response to a retryable error. Most of those errors boil down to the fact that the layout state has changed in some fashion. Thus, what we really want to do is to re-search for a layout when it fails with a retryable error, so that we can avoid reissuing the RPC at all if possible. While the LAYOUTGET RPC is async, the initiating thread always waits for it to complete, so it's effectively synchronous anyway. Currently, when we need to retry a LAYOUTGET because of an error, we drive that retry via the rpc state machine. This means that once the call has been submitted, it runs until it completes. So, we must move the error handling for this RPC out of the rpc_call_done operation and into the caller. In order to handle errors like NFS4ERR_DELAY properly, we must also pass a pointer to the sliding timeout, which is now moved to the stack in pnfs_update_layout. The complicating errors are -NFS4ERR_RECALLCONFLICT and -NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give up and return NULL back to the caller. So, there is some special handling for those errors to ensure that the layers driving the retries can handle that appropriately. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-05-17 19:28:47 +03:00
__field(long, lseg)
__field(enum pnfs_update_layout_reason, reason)
),
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->fileid = NFS_FILEID(inode);
__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
__entry->pos = pos;
__entry->count = count;
__entry->iomode = iomode;
__entry->reason = reason;
if (lo != NULL) {
__entry->layoutstateid_seq =
be32_to_cpu(lo->plh_stateid.seqid);
__entry->layoutstateid_hash =
nfs_stateid_hash(&lo->plh_stateid);
} else {
__entry->layoutstateid_seq = 0;
__entry->layoutstateid_hash = 0;
}
pnfs: rework LAYOUTGET retry handling There are several problems in the way a stateid is selected for a LAYOUTGET operation: We pick a stateid to use in the RPC prepare op, but that makes it difficult to serialize LAYOUTGETs that use the open stateid. That serialization is done in pnfs_update_layout, which occurs well before the rpc_prepare operation. Between those two events, the i_lock is dropped and reacquired. pnfs_update_layout can find that the list has lsegs in it and not do any serialization, but then later pnfs_choose_layoutget_stateid ends up choosing the open stateid. This patch changes the client to select the stateid to use in the LAYOUTGET earlier, when we're searching for a usable layout segment. This way we can do it all while holding the i_lock the first time, and ensure that we serialize any LAYOUTGET call that uses a non-layout stateid. This also means a rework of how LAYOUTGET replies are handled, as we must now get the latest stateid if we want to retransmit in response to a retryable error. Most of those errors boil down to the fact that the layout state has changed in some fashion. Thus, what we really want to do is to re-search for a layout when it fails with a retryable error, so that we can avoid reissuing the RPC at all if possible. While the LAYOUTGET RPC is async, the initiating thread always waits for it to complete, so it's effectively synchronous anyway. Currently, when we need to retry a LAYOUTGET because of an error, we drive that retry via the rpc state machine. This means that once the call has been submitted, it runs until it completes. So, we must move the error handling for this RPC out of the rpc_call_done operation and into the caller. In order to handle errors like NFS4ERR_DELAY properly, we must also pass a pointer to the sliding timeout, which is now moved to the stack in pnfs_update_layout. The complicating errors are -NFS4ERR_RECALLCONFLICT and -NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give up and return NULL back to the caller. So, there is some special handling for those errors to ensure that the layers driving the retries can handle that appropriately. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-05-17 19:28:47 +03:00
__entry->lseg = (long)lseg;
),
TP_printk(
"fileid=%02x:%02x:%llu fhandle=0x%08x "
"iomode=%s pos=%llu count=%llu "
pnfs: rework LAYOUTGET retry handling There are several problems in the way a stateid is selected for a LAYOUTGET operation: We pick a stateid to use in the RPC prepare op, but that makes it difficult to serialize LAYOUTGETs that use the open stateid. That serialization is done in pnfs_update_layout, which occurs well before the rpc_prepare operation. Between those two events, the i_lock is dropped and reacquired. pnfs_update_layout can find that the list has lsegs in it and not do any serialization, but then later pnfs_choose_layoutget_stateid ends up choosing the open stateid. This patch changes the client to select the stateid to use in the LAYOUTGET earlier, when we're searching for a usable layout segment. This way we can do it all while holding the i_lock the first time, and ensure that we serialize any LAYOUTGET call that uses a non-layout stateid. This also means a rework of how LAYOUTGET replies are handled, as we must now get the latest stateid if we want to retransmit in response to a retryable error. Most of those errors boil down to the fact that the layout state has changed in some fashion. Thus, what we really want to do is to re-search for a layout when it fails with a retryable error, so that we can avoid reissuing the RPC at all if possible. While the LAYOUTGET RPC is async, the initiating thread always waits for it to complete, so it's effectively synchronous anyway. Currently, when we need to retry a LAYOUTGET because of an error, we drive that retry via the rpc state machine. This means that once the call has been submitted, it runs until it completes. So, we must move the error handling for this RPC out of the rpc_call_done operation and into the caller. In order to handle errors like NFS4ERR_DELAY properly, we must also pass a pointer to the sliding timeout, which is now moved to the stack in pnfs_update_layout. The complicating errors are -NFS4ERR_RECALLCONFLICT and -NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give up and return NULL back to the caller. So, there is some special handling for those errors to ensure that the layers driving the retries can handle that appropriately. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-05-17 19:28:47 +03:00
"layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid,
__entry->fhandle,
show_pnfs_iomode(__entry->iomode),
(unsigned long long)__entry->pos,
(unsigned long long)__entry->count,
__entry->layoutstateid_seq, __entry->layoutstateid_hash,
pnfs: rework LAYOUTGET retry handling There are several problems in the way a stateid is selected for a LAYOUTGET operation: We pick a stateid to use in the RPC prepare op, but that makes it difficult to serialize LAYOUTGETs that use the open stateid. That serialization is done in pnfs_update_layout, which occurs well before the rpc_prepare operation. Between those two events, the i_lock is dropped and reacquired. pnfs_update_layout can find that the list has lsegs in it and not do any serialization, but then later pnfs_choose_layoutget_stateid ends up choosing the open stateid. This patch changes the client to select the stateid to use in the LAYOUTGET earlier, when we're searching for a usable layout segment. This way we can do it all while holding the i_lock the first time, and ensure that we serialize any LAYOUTGET call that uses a non-layout stateid. This also means a rework of how LAYOUTGET replies are handled, as we must now get the latest stateid if we want to retransmit in response to a retryable error. Most of those errors boil down to the fact that the layout state has changed in some fashion. Thus, what we really want to do is to re-search for a layout when it fails with a retryable error, so that we can avoid reissuing the RPC at all if possible. While the LAYOUTGET RPC is async, the initiating thread always waits for it to complete, so it's effectively synchronous anyway. Currently, when we need to retry a LAYOUTGET because of an error, we drive that retry via the rpc state machine. This means that once the call has been submitted, it runs until it completes. So, we must move the error handling for this RPC out of the rpc_call_done operation and into the caller. In order to handle errors like NFS4ERR_DELAY properly, we must also pass a pointer to the sliding timeout, which is now moved to the stack in pnfs_update_layout. The complicating errors are -NFS4ERR_RECALLCONFLICT and -NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give up and return NULL back to the caller. So, there is some special handling for those errors to ensure that the layers driving the retries can handle that appropriately. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-05-17 19:28:47 +03:00
__entry->lseg,
show_pnfs_update_layout_reason(__entry->reason)
)
);
#endif /* CONFIG_NFS_V4_1 */
#endif /* _TRACE_NFS4_H */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE nfs4trace
/* This part must be outside protection */
#include <trace/define_trace.h>