[PATCH v1 0/3] nfsd: expose NFSv4 client state through Netlink
From: Prabhakar Pujeri
Date: Tue Aug 25 2026 - 02:53:49 EST
Administrators can inspect NFSv4 clients through the nfsd filesystem, but
collecting a server-wide view requires walking a directory and opening
multiple files for every client. That is useful for detailed inspection,
but awkward for monitoring and automation.
Add a compact query interface to the existing nfsd Generic Netlink family:
1. Extend threads-get with an explicit NFSv4 recovery-grace value.
2. Add a privileged client-get dump with basic identity, lease,
confirmation, reclaim, and callback information.
3. Extend each client reply with session and stateid record counts.
The split keeps the grace query independent, establishes the minimum useful
client ABI before adding the more expensive state traversal, and permits
older user space to ignore the count extension. The existing nfsd
filesystem files and their output remain unchanged.
client-get emits one bounded message per client. The dump pins each client,
uses the existing client and state locks for mutable fields, and serializes
against server shutdown. Client churn can still make a multi-message dump a
best-effort snapshot; the interface documentation states this explicitly.
The Netlink client ID places cl_boot in the upper 32 bits and cl_id in the
lower 32 bits. This is an architecture-independent representation matching
NFSD's logical and tracepoint representation, rather than the legacy procfs
rendering of the in-memory bytes.
A companion nfs-utils series adds `nfsdctl clients` and displays the grace
value from `nfsdctl threads`.
Validation performed:
- strict checkpatch on each patch: 0 errors, 0 warnings, 0 checks
- YNL regeneration and headers_install
- scoped NFS admin and Netlink documentation builds with SPHINXOPTS=-W
- W=1 NFSD builds with CONFIG_NFSD_V4=y and CONFIG_NFSD_V4=n
- two-vCPU QEMU test with a live NFSv4.2 loopback mount
- grace yes/no transition checked through both raw Netlink and nfsdctl
- one live client with one session, open stateid, lock stateid, and
delegation stateid; zero layout stateids
- legacy /proc/fs/nfsd/clients output checked for unchanged fields
The series is based on the nfsd-testing branch. The exact base is recorded
in the base-commit trailer below.
Prabhakar Pujeri (3):
nfsd: report NFSv4 grace state through Netlink
nfsd: add a Netlink dump of NFSv4 clients
nfsd: report per-client NFSv4 state usage through Netlink
.../admin-guide/nfs/nfsd-admin-interfaces.rst | 22 ++
Documentation/netlink/specs/nfsd.yaml | 106 ++++++++
fs/nfsd/netlink.c | 5 +
fs/nfsd/netlink.h | 1 +
fs/nfsd/nfs4ctl.h | 10 +
fs/nfsd/nfs4state.c | 238 +++++++++++++++++-
fs/nfsd/nfsctl.c | 22 +-
include/uapi/linux/nfsd_netlink.h | 41 +++
8 files changed, 443 insertions(+), 2 deletions(-)
base-commit: 46ff234c7129c7c10ed493413d4f60d0cf4dd1f1
--
2.54.0