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 v4 3/4] nfsd: implement server-stats-get netlink handler
Date: Wed, 17 Jun 2026 11:25:02 -0400 [thread overview]
Message-ID: <ea1230d947d8bcdf5dc25f8f90fb46d4c0b155c5.camel@kernel.org> (raw)
In-Reply-To: <c62cacac-dc7e-4203-b83e-000d04f797fb@app.fastmail.com>
On Wed, 2026-06-17 at 09:18 -0400, Chuck Lever wrote:
>
> On Wed, Jun 17, 2026, at 7:07 AM, Jeff Layton wrote:
> > On Tue, 2026-06-16 at 20:57 -0400, Chuck Lever wrote:
> > > Hey Jeff -
> > >
> > > On Tue, Jun 16, 2026, at 8:45 AM, Jeff Layton wrote:
> > > > Implement nfsd_nl_server_stats_get_dumpit() which exposes the
> > > > NFS server statistics currently available via /proc/net/rpc/nfsd
> > > > through the nfsd generic netlink family.
> > > >
> > > > The handler uses a dump operation to stream statistics across
> > > > multiple netlink messages:
> > > >
> > > > - First message: all scalar stats (reply cache, filehandle,
> > > > IO, network, RPC) plus per-version procedure counts
> > > > (proc2/3/4-ops) using per-netns vs_count arrays.
> > > >
> > > > - Subsequent messages: NFSv4 per-operation counts
> > > > (proc4ops-ops), one entry per message, using cb->args[0]
> > > > to track the current operation index across dump calls.
> > > >
> > > > This allows nfsstat to retrieve server statistics via netlink
> > > > with a procfs fallback for older kernels.
> > > >
> > > > Assisted-by: Claude:claude-opus-4-6
> > > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > > ---
> > > > Documentation/netlink/specs/nfsd.yaml | 105 +++++++++++++++++
> > > > fs/nfsd/netlink.c | 5 +
> > > > fs/nfsd/netlink.h | 2 +
> > > > fs/nfsd/nfsctl.c | 206 ++++++++++++++++++++++++++++++++++
> > > > include/uapi/linux/nfsd_netlink.h | 35 ++++++
> > > > 5 files changed, 353 insertions(+)
> > >
> > > The procfs output in nfsd_show() emits one more counter that this dump
> > > handler drops: wdeleg_getattr (NFSD_STATS_WDELEG_GETATTR), printed at
> > > the end of the CONFIG_NFSD_V4 block in fs/nfsd/stats.c, right after
> > > proc4ops. The netlink dump stops after proc4ops-ops and sets
> > > cb->args[0] = -1, so the write-delegation GETATTR-conflict counter never
> > > goes out on the wire.
> > >
> > > There's no schema slot for it either: the server-stats attribute-set
> > > ends at proc4ops-ops, so a consumer that prefers netlink and only falls
> > > back to procfs on an old kernel loses this counter on every kernel new
> > > enough to support server-stats-get.
> > >
> > > I Suggest:
> > >
> > > - add a wdeleg-getattr (u64) attribute to the server-stats
> > > attribute-set in nfsd.yaml and list it under the dump reply
> > > attributes;
> > >
> > > - add NFSD_A_SERVER_STATS_WDELEG_GETATTR to the uapi enum, after
> > > PROC4OPS_OPS and before __NFSD_A_SERVER_STATS_MAX so existing
> > > values don't shift;
> > >
> > > - emit it as a single scalar in the start == 0 message, wrapped in
> > > CONFIG_NFSD_V4 to match the procfs side.
> > >
> >
> > This omission was intentional. The stated purpose of this patchset was
> > to convert nfsstat to use netlink. nfsstat does not access or display
> > this field today. Without something that consumes this stat, I don't
> > see the point of adding it here. We can always add it later when/if it
> > becomes useful to userland.
>
> If we were adding a greenfield kernel-userspace API, I would agree.
> However, this API is meant to be compatible with the existing
> procfs API, so it should match to prevent a regression (I'm not
> aware of a consumer, this is only a general guideline).
>
> For future reference: since a missing feature cannot be expressed
> in a patch's diff body, your intention to exclude this field could
> be mentioned in the commit message.
>
>
> > Is there something that accesses this today that I'm not aware of? If
> > not, is there some future intent to add this to nfsstat?
>
> I think nfsstat should display the wdeleg-getattr field. It has simply
> been forgotten.
>
Ok. I'll plan to add it to the interface and send it in v5. nfs-utils
will need a follow-on patch to display the value. No promises on when
I'll do that, but it shouldn't be too hard.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-06-17 15:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 12:45 [PATCH v4 0/4] nfsd/sunrpc: convert nfsstat server-side interfaces to use netlink Jeff Layton
2026-06-16 12:45 ` [PATCH v4 1/4] sunrpc: add per-netns per-procedure call counts to svc_stat Jeff Layton
2026-06-16 23:55 ` Chuck Lever
2026-06-17 11:04 ` Jeff Layton
2026-06-16 12:45 ` [PATCH v4 2/4] sunrpc: use per-net counts in svc_seq_show() Jeff Layton
2026-06-16 12:45 ` [PATCH v4 3/4] nfsd: implement server-stats-get netlink handler Jeff Layton
2026-06-17 0:57 ` Chuck Lever
2026-06-17 11:07 ` Jeff Layton
2026-06-17 13:18 ` Chuck Lever
2026-06-17 15:25 ` Jeff Layton [this message]
2026-06-17 17:52 ` Jeff Layton
2026-06-17 18:46 ` Chuck Lever
2026-06-16 12:45 ` [PATCH v4 4/4] sunrpc: remove unused svc_version vs_count field 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=ea1230d947d8bcdf5dc25f8f90fb46d4c0b155c5.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