From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH RFC 9/9] NFSD: Trace delegation revocations
Date: Thu, 06 Oct 2022 12:06:23 -0400 [thread overview]
Message-ID: <29bbe1baca5c86908d62c3ea83f7c3eb1ab22d9c.camel@kernel.org> (raw)
In-Reply-To: <166498179300.1527.10706291618523188126.stgit@manet.1015granger.net>
On Wed, 2022-10-05 at 10:56 -0400, Chuck Lever wrote:
> Revocation is an exceptional event. Generate a trace record when it
> occurs so that other activity can be triggered.
>
> Example:
>
> nfsd-1104 [005] 1912.002544: nfsd_stid_revoke: client 633c9343:4e82788d stateid 00000003:00000001 ref=2 type=DELEG
>
> Trace infrastructure is provided for subsequent additional tracing
> related to nfs4_stid activity.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> fs/nfsd/nfs4state.c | 2 ++
> fs/nfsd/trace.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 57 insertions(+)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 06499b9481a6..349302afa7eb 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1404,6 +1404,8 @@ static void revoke_delegation(struct nfs4_delegation *dp)
>
> WARN_ON(!list_empty(&dp->dl_recall_lru));
>
> + trace_nfsd_stid_revoke(&dp->dl_stid);
> +
> if (clp->cl_minorversion) {
> dp->dl_stid.sc_type = NFS4_REVOKED_DELEG_STID;
> refcount_inc(&dp->dl_stid.sc_count);
> diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
> index 4921144880d3..23fb39c957af 100644
> --- a/fs/nfsd/trace.h
> +++ b/fs/nfsd/trace.h
> @@ -561,6 +561,61 @@ DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \
> DEFINE_STATESEQID_EVENT(preprocess);
> DEFINE_STATESEQID_EVENT(open_confirm);
>
> +TRACE_DEFINE_ENUM(NFS4_OPEN_STID);
> +TRACE_DEFINE_ENUM(NFS4_LOCK_STID);
> +TRACE_DEFINE_ENUM(NFS4_DELEG_STID);
> +TRACE_DEFINE_ENUM(NFS4_CLOSED_STID);
> +TRACE_DEFINE_ENUM(NFS4_REVOKED_DELEG_STID);
> +TRACE_DEFINE_ENUM(NFS4_CLOSED_DELEG_STID);
> +TRACE_DEFINE_ENUM(NFS4_LAYOUT_STID);
> +
> +#define show_stid_type(x) \
> + __print_flags(x, "|", \
> + { NFS4_OPEN_STID, "OPEN" }, \
> + { NFS4_LOCK_STID, "LOCK" }, \
> + { NFS4_DELEG_STID, "DELEG" }, \
> + { NFS4_CLOSED_STID, "CLOSED" }, \
> + { NFS4_REVOKED_DELEG_STID, "REVOKED" }, \
> + { NFS4_CLOSED_DELEG_STID, "CLOSED_DELEG" }, \
> + { NFS4_LAYOUT_STID, "LAYOUT" })
> +
> +DECLARE_EVENT_CLASS(nfsd_stid_class,
> + TP_PROTO(
> + const struct nfs4_stid *stid
> + ),
> + TP_ARGS(stid),
> + TP_STRUCT__entry(
> + __field(unsigned long, sc_type)
> + __field(int, sc_count)
> + __field(u32, cl_boot)
> + __field(u32, cl_id)
> + __field(u32, si_id)
> + __field(u32, si_generation)
> + ),
> + TP_fast_assign(
> + const stateid_t *stp = &stid->sc_stateid;
> +
> + __entry->sc_type = stid->sc_type;
> + __entry->sc_count = refcount_read(&stid->sc_count);
> + __entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
> + __entry->cl_id = stp->si_opaque.so_clid.cl_id;
> + __entry->si_id = stp->si_opaque.so_id;
> + __entry->si_generation = stp->si_generation;
> + ),
> + TP_printk("client %08x:%08x stateid %08x:%08x ref=%d type=%s",
> + __entry->cl_boot, __entry->cl_id,
> + __entry->si_id, __entry->si_generation,
> + __entry->sc_count, show_stid_type(__entry->sc_type)
> + )
> +);
> +
> +#define DEFINE_STID_EVENT(name) \
> +DEFINE_EVENT(nfsd_stid_class, nfsd_stid_##name, \
> + TP_PROTO(const struct nfs4_stid *stid), \
> + TP_ARGS(stid))
> +
> +DEFINE_STID_EVENT(revoke);
> +
> DECLARE_EVENT_CLASS(nfsd_clientid_class,
> TP_PROTO(const clientid_t *clid),
> TP_ARGS(clid),
>
>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2022-10-06 16:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-05 14:55 [PATCH RFC 0/9] A course adjustment, maybe Chuck Lever
2022-10-05 14:55 ` [PATCH RFC 1/9] nfsd: fix nfsd_file_unhash_and_dispose Chuck Lever
2022-10-05 14:55 ` [PATCH RFC 2/9] nfsd: rework hashtable handling in nfsd_do_file_acquire Chuck Lever
2022-10-05 14:55 ` [PATCH RFC 3/9] NFSD: Pass the target nfsd_file to nfsd_commit() Chuck Lever
2022-10-05 14:56 ` [PATCH RFC 4/9] NFSD: Revert "NFSD: NFSv4 CLOSE should release an nfsd_file immediately" Chuck Lever
2022-10-05 14:56 ` [PATCH RFC 5/9] NFSD: Add an NFSD_FILE_GC flag to enable nfsd_file garbage collection Chuck Lever
2022-10-06 15:59 ` Jeff Layton
2022-10-06 16:06 ` Chuck Lever III
2022-10-05 14:56 ` [PATCH RFC 6/9] NFSD: Use const pointers as parameters to fh_ helpers Chuck Lever
2022-10-06 15:59 ` Jeff Layton
2022-10-05 14:56 ` [PATCH RFC 7/9] NFSD: Use rhashtable for managing nfs4_file objects Chuck Lever
2022-10-05 15:11 ` Chuck Lever III
2022-10-06 16:12 ` Jeff Layton
2022-10-06 16:15 ` Chuck Lever III
2022-10-05 14:56 ` [PATCH RFC 8/9] NFSD: Clean up nfs4_preprocess_stateid_op() call sites Chuck Lever
2022-10-06 16:05 ` Jeff Layton
2022-10-05 14:56 ` [PATCH RFC 9/9] NFSD: Trace delegation revocations Chuck Lever
2022-10-06 16:06 ` Jeff Layton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29bbe1baca5c86908d62c3ea83f7c3eb1ab22d9c.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).