[PATCH v2 0/4] nfsd/sunrpc: convert nfsstat server-side interfaces to use netlink
From: Jeff Layton
Date: Mon May 25 2026 - 08:39:07 EST
The nfsstat tool currently scrapes /proc/net/rpc/nfsd for server
statistics. This procfs interface has several limitations: the
counters are global (not network-namespace-aware), the format is
fragile to parse, and it cannot be extended without breaking
existing parsers.
This series adds per-network-namespace procedure call counts to
the sunrpc layer and exposes them through a new netlink handler
in the nfsd generic netlink family, allowing nfsstat to retrieve
server statistics via netlink with a procfs fallback for older
kernels.
Patch 1 adds per-netns per-procedure percpu call count arrays to
struct svc_stat, allocated alongside the nfsd_net lifecycle.
Patch 2 switches svc_seq_show() to read from the per-netns
counters, making /proc/net/rpc/nfsd namespace-aware. Note that this
is a behavior change, but I think it's a desirable one.
Patch 3 implements the server-stats-get netlink dump handler,
streaming reply-cache, filehandle, IO, network, and RPC
statistics plus per-version and per-operation procedure counts.
Patch 4 removes the now-unused global svc_version vs_count
percpu arrays from nfsd, lockd, and the NFS client callback
service.
I'll also be sending an nfs-utils patch to convert nfsstat to use the
new interfaces.
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
Jeff Layton (4):
sunrpc: add per-netns per-procedure call counts to svc_stat
sunrpc: use per-net counts in svc_seq_show()
nfsd: implement server-stats-get netlink handler
sunrpc: remove unused svc_version vs_count field
Documentation/netlink/specs/nfsd.yaml | 105 ++++++++++++++++
fs/lockd/svc4proc.c | 4 -
fs/lockd/svcproc.c | 7 --
fs/nfs/callback_xdr.c | 6 -
fs/nfsd/localio.c | 3 -
fs/nfsd/netlink.c | 5 +
fs/nfsd/netlink.h | 2 +
fs/nfsd/nfs2acl.c | 3 -
fs/nfsd/nfs3acl.c | 3 -
fs/nfsd/nfs3proc.c | 3 -
fs/nfsd/nfs4proc.c | 3 -
fs/nfsd/nfsctl.c | 221 +++++++++++++++++++++++++++++++++-
fs/nfsd/nfsproc.c | 3 -
include/linux/sunrpc/stats.h | 6 +
include/linux/sunrpc/svc.h | 1 -
include/uapi/linux/nfsd_netlink.h | 35 ++++++
net/sunrpc/stats.c | 56 ++++++++-
net/sunrpc/svc.c | 8 +-
18 files changed, 434 insertions(+), 40 deletions(-)
---
base-commit: 887d478bb2115cec0be8caae58bad4d4b3109b1a
change-id: 20260316-exportd-netlink-1c9fb52536e3
Best regards,
--
Jeff Layton <jlayton@xxxxxxxxxx>