Skip to content

nfsd: expose NFSv4 client state through Netlink

Prabhakar Pujeri linux-nfs 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyIn review
  2. v22 patches 2 repliesSuperseded
  3. v13 patches 5 repliesSuperseded

Changes in v3 from the cover letter

- rename the client lookup helper to nfsd_nl_find_client() ("get" connotes refcounting)
- validate the client-table argument explicitly in nfsd_nl_find_client() instead of aliasing NFSD4_NL_CLIENT_DONE to "unconfirmed"
- rename nfsd4_nl_client_put_address() to nfsd4_nl_client_marshal_address() ("put" connotes refcounting)
- document the confirmed-then-unconfirmed table ordering in the dump loop comments
- rebase onto nfsd-testing at ac579868af0c

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2nfsd: add a Netlink dump of NFSv4 clientsDocumentation/admin-guide/nfs/nfsd-admin-interfaces.rst Documentation/netlink/specs/nfsd.yaml fs/nfsd/netlink.c +6 more+437 -01 reply
2/2nfsd: report per-client NFSv4 state usage through NetlinkDocumentation/admin-guide/nfs/nfsd-admin-interfaces.rst Documentation/netlink/specs/nfsd.yaml fs/nfsd/nfs4layouts.c +3 more+130 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] nfsd: expose NFSv4 client state through Netlink

Administrators can inspect NFSv4 clients through the nfsd filesystem, but collecting a server-wide view requires walking one directory and opening multiple files for every client. That interface remains useful for detailed inspection, but it is awkward for monitoring and automation.

Add a compact, privileged query to the existing nfsd Generic Netlink family:

1. Dump basic NFSv4 client identity, address, lease, confirmation, reclaim, and callback state.
2. Add O(1) snapshots of per-client session and stateid record counts.

The existing nfsd filesystem files and their output remain unchanged. A companion nfs-utils v2 series adds nfsdctl clients; its cover Message-ID is:

<[email protected]>

This reroll intentionally drops the grace-status patch. As discussed with Chuck, that interface needs an explicitly scoped design that can represent both current server-wide grace and possible per-export grace in the future. I will address it in a separate proposal.

Changes since v2 (feedback from Jeff Layton):

- rename the client lookup helper to nfsd_nl_find_client() ("get" connotes refcounting)
- validate the client-table argument explicitly in nfsd_nl_find_client() instead of aliasing NFSD4_NL_CLIENT_DONE to "unconfirmed"
- rename nfsd4_nl_client_put_address() to nfsd4_nl_client_marshal_address() ("put" connotes refcounting)
- document the confirmed-then-unconfirmed table ordering in the dump loop comments
- rebase onto nfsd-testing at ac579868af0c

Changes since v1:

- replace the raw sockaddr attribute with separate IPv4/IPv6 address, port, and optional IPv6 scope-ID attributes
- add a nonzero client-table generation and genl_dump_check_consistent(), so churn marks the dump NLM_F_DUMP_INTR
- replace session-list and stateid-IDR walks under cl_lock with maintained u64 counters, making every per-client snapshot O(1)
- encode counts as variable-width Netlink uint attributes
- drop the grace-status patch for a separately scoped design
- rebase onto nfsd-testing at 65b583e874b3

Validation performed:

- strict checkpatch on both patches
- focused NFSD W=1 build of fs/nfsd on nfsd-testing at ac579868af0c

v1: https://lore.kernel.org/r/[email protected]
v2: https://lore.kernel.org/r/[email protected]

Prabhakar Pujeri (2):
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         | 118 ++++++
 fs/nfsd/netlink.c                             |   5 +
 fs/nfsd/netlink.h                             |   1 +
 fs/nfsd/netns.h                               |   1 +
 fs/nfsd/nfs4ctl.h                             |  10 +
 fs/nfsd/nfs4layouts.c                         |   2 +-
 fs/nfsd/nfs4state.c                           | 353 +++++++++++++++++-
 fs/nfsd/nfsctl.c                              |  13 +
 fs/nfsd/state.h                               |   7 +
 include/uapi/linux/nfsd_netlink.h             |  43 +++
 11 files changed, 565 insertions(+), 10 deletions(-)

base-commit: ac579868af0c900d8fd9c8cfe9e10db46ccc5a75

Signature · 1 line
2.55.0