From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Steve Dickson <steved@redhat.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 3/6] nfsd: implement server-stats-get netlink handler
Date: Thu, 16 Jul 2026 10:54:34 -0400 [thread overview]
Message-ID: <ba4366c69a21e42cd9da5a0314e762dd25240b97.camel@kernel.org> (raw)
In-Reply-To: <c7ebc7af-9bb0-4c10-8295-7b60b8507bfd@app.fastmail.com>
On Thu, 2026-07-16 at 10:28 -0400, Chuck Lever wrote:
>
> On Thu, Jul 16, 2026, at 10:16 AM, Chuck Lever wrote:
> > On Thu, Jul 16, 2026, at 10:12 AM, Jeff Layton wrote:
> > > On Thu, 2026-07-16 at 10:04 -0400, Chuck Lever wrote:
> > > >
> > > > On Thu, Jul 16, 2026, at 9:53 AM, Jeff Layton wrote:
> > > > > On Fri, 2026-06-19 at 16:40 -0400, Chuck Lever wrote:
> > > > > >
> > > > > > On Fri, Jun 19, 2026, at 11:26 AM, Jeff Layton wrote:
> > > >
> > > > > > > + /* Per-version procedure counts */
> > > > > > > + if (statp->vs_count) {
> > > > > > > + static const int proc_attrs[] = {
> > > > > > > + [2] = NFSD_A_SERVER_STATS_PROC2_OPS,
> > > > > > > + [3] = NFSD_A_SERVER_STATS_PROC3_OPS,
> > > > > > > + [4] = NFSD_A_SERVER_STATS_PROC4_OPS,
> > > > > > > + };
> > > > > > > + unsigned int i;
> > > > > > > +
> > > > > > > + for (i = 0; i < prog->pg_nvers &&
> > > > > > > + i < ARRAY_SIZE(proc_attrs); i++) {
> > > > > > > + if (!prog->pg_vers[i] ||
> > > > > > > + !statp->vs_count[i])
> > > > > > > + continue;
> > > > > > > + if (!proc_attrs[i])
> > > > > > > + continue;
> > > > > > > + if (nfsd_nl_fill_proc_ops(skb,
> > > > > > > + proc_attrs[i],
> > > > > > > + statp->vs_count[i],
> > > > > > > + prog->pg_vers[i]->vs_nproc))
> > > > > > > + goto err_cancel;
> > > > > > > + }
> > > > > > > + }
> > > > > > > +
> > > > > > > +#ifdef CONFIG_NFSD_V4
> > > > > > > + /* NFSv4 individual operation counts */
> > > > > > > + for (int i = 0; i <= LAST_NFS4_OP; i++) {
> > > > > > > + struct nlattr *nest;
> > > > > > > + u64 cnt;
> > > > > > > +
> > > > > > > + cnt = percpu_counter_sum_positive(
> > > > > > > + &nn->counter[NFSD_STATS_NFS4_OP(i)]);
> > > > > > > +
> > > > > > > + nest = nla_nest_start(skb,
> > > > > > > + NFSD_A_SERVER_STATS_PROC4OPS_OPS);
> > > > > > > + if (!nest)
> > > > > > > + goto err_cancel;
> > > > > > > + if (nla_put_u32(skb, NFSD_A_SERVER_PROC_ENTRY_OP, i) ||
> > > > > > > + nla_put_u64_64bit(skb, NFSD_A_SERVER_PROC_ENTRY_COUNT,
> > > > > > > + cnt, NFSD_A_SERVER_PROC_ENTRY_PAD)) {
> > > > > > > + nla_nest_cancel(skb, nest);
> > > > > > > + goto err_cancel;
> > > > > > > + }
> > > > > > > + nla_nest_end(skb, nest);
> > > > > > > + }
> > > > > > > +#endif
> > > > > >
> > > > > > This loop open-codes the same nest that nfsd_nl_fill_proc_ops() builds just
> > > > > > above -- nla_nest_start(), nla_put_u32(PROC_ENTRY_OP),
> > > > > > nla_put_u64_64bit(PROC_ENTRY_COUNT), nla_nest_end() -- into the same
> > > > > > NFSD_A_SERVER_STATS_PROC4OPS_OPS attribute. Could the helper be generalized
> > > > > > to take the per-op counter source so this is not a second copy of the same
> > > > > > code?
> > > > > >
> > > > > > The per-version block above skips empty versions:
> > > > > >
> > > > > > if (!prog->pg_vers[i] || !statp->vs_count[i])
> > > > > > continue;
> > > > > >
> > > > > > but this loop emits an entry for every op 0..LAST_NFS4_OP, zero-count ops
> > > > > > included. Is that difference intentional? Skipping zero counts here would
> > > > > > also trim the worst-case message size above.
> > > > > >
> > > > > > There is also a counter that this dump does not emit. /proc/net/rpc/nfsd
> > > > > > prints a wdeleg_getattr line after proc4ops:
> > > > > >
> > > > > > seq_printf(seq, "\nwdeleg_getattr %lld",
> > > > > > percpu_counter_sum_positive(&nn->counter[NFSD_STATS_WDELEG_GETATTR]));
> > > > > >
> > > > > > incremented by nfsd_stats_wdeleg_getattr_inc(). Since the goal is to expose
> > > > > > the statistics currently available via /proc/net/rpc/nfsd, should
> > > > > > wdeleg_getattr get an attribute here too, so nfsstat over netlink does not
> > > > > > drop it relative to the procfs path?
> > > > > >
> > > > >
> > > > > The only thing in this review that is not addressed in my current
> > > > > series is the above comment, and I think we had agreed in an earlier
> > > > > email thread that this was approximately the same value as the counter
> > > > > for CB_GETATTR calls and so it's good enough for this purpose.
> > > > >
> > > > > Are you still ok with this approach?
> > > >
> > > > In spite of the email quoting, I’ve still forgotten most of the context
> > > > of that conversation.
> > > >
> > > > Looking at this now, I think someone later could get an urge to add the
> > > > wdeleg_getattr statistic to netlink… for symmetry, because it smells like
> > > > technical debt, or it might actually be useful for something.
> > > >
> > > > IMHO we should include it now.
> > > >
> > >
> > > IDGI: what's the point of collecting that stat separately when we have
> > > stats for CB_GETATTR already? I'd prefer to avoid perpetuating
> > > wdeleg_getattr as a stat here, since it's not directly tied to the
> > > protocol in the same way as the others are.
> > >
> > > The only difference between the two is that if another client does a
> > > GETATTR for the fh while there is already a CB_GETATTR in flight,
> > > wdeleg_getattr gets bumped today, whereas CB_GETATTR counter does not
> > > (since there is only a single CB_GETATTR for that).
> > >
> > > Is that difference relevant? I think Dai added wdeleg_getattr
> > > originally, so I'd really like to hear his opinion on this.
> >
> > OK, so you are actually re-litigating whether the stat should exist
> > at all. I confess I had forgotten that context.
> >
More or less. IIRC:
We had decided that wdeleg_getattr was sort of an oddity that didn't
really belong in this /proc file. The values in that file are mostly
counting other very specific protocol operations, but wdeleg_getattr is
basically counting GETATTR operations from other clients while there is
an outstanding write delegation on a file.
Since CB_GETATTR counts should approximate wdeleg_getattr, we decided
to start counting those instead (along with all of the other callback
ops). wdeleg_getattr in this series is changed to just report
CB_GETATTR counts.
> > I’m arguing only that the netlink and procfs APIs should remain
> > equivalent, at least initially. Deleting the stat entirely probably
> > has no consequences right now, but let’s hear from Dai when the US
> > west coast wakes up.
>
> Another option is to keep the stat but report it some other way.
> It is arguable whether nfsstat is the proper mechanism to report
> the different reasons for sending a CB_GETATTR.
>
Sure. We could add some way to keep reporting it (or just keep using
/proc for this). AFAIK though, there is no (public) consumer of this
stat. nfs-utils doesn't look at it.
To wit: I'd like to head a clear use-case for this stat before we
decide to we need to count it like we did before.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-07-16 14:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 15:26 [PATCH v6 0/6] nfsd/sunrpc: convert nfsstat server-side interfaces to use netlink Jeff Layton
2026-06-19 15:26 ` [PATCH v6 1/6] sunrpc: add per-netns per-procedure call counts to svc_stat Jeff Layton
2026-06-19 15:26 ` [PATCH v6 2/6] sunrpc: use per-net counts in svc_seq_show() Jeff Layton
2026-06-19 15:26 ` [PATCH v6 3/6] nfsd: implement server-stats-get netlink handler Jeff Layton
2026-06-19 20:40 ` Chuck Lever
2026-07-16 13:53 ` Jeff Layton
2026-07-16 14:04 ` Chuck Lever
2026-07-16 14:12 ` Jeff Layton
2026-07-16 14:16 ` Chuck Lever
2026-07-16 14:28 ` Chuck Lever
2026-07-16 14:54 ` Jeff Layton [this message]
2026-07-17 19:42 ` Dai Ngo
2026-06-19 15:26 ` [PATCH v6 4/6] sunrpc: remove unused svc_version vs_count field Jeff Layton
2026-06-19 15:26 ` [PATCH v6 5/6] nfsd: count NFSv4 callback operations per netns Jeff Layton
2026-06-19 20:41 ` Chuck Lever
2026-06-19 15:26 ` [PATCH v6 6/6] nfsd: export NFSv4 callback op stats via netlink Jeff Layton
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=ba4366c69a21e42cd9da5a0314e762dd25240b97.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=cel@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=steved@redhat.com \
--cc=tom@talpey.com \
--cc=trondmy@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
powered by JetHome