[PATCH 00/14] nfsd/sunrpc: add support for netlink upcalls for mountd/exportd

From: Jeff Layton

Date: Mon Mar 16 2026 - 11:19:53 EST


mountd/exportd use the sunrpc cache mechanism for some of its internal
caches that are populated by userland. These currently use some very
antiquated interfaces in /proc to handle upcalls and downcalls. While it
has worked well for decades and is relatively stable, it has some
problems:

Most notably, it's very difficult to extend to add support for new
export options. There is also the matter of requiring /proc which is not
always desirable in a container.

This patchset adds new netlink-based interfaces for handling the sunrpc
cache upcalls. The basic idea is to add a new "cache_notify" operation
to struct cache_detail. That causes the kernel to send a notification to
userland which then fetches any outstanding cache_requests and then
responds to them via netlink.

There is also a companion patchset for nfs-utils that adds the necessary
support for these interfaces to mountd/exportd and exportfs.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
Jeff Layton (14):
nfsd: move struct nfsd_genl_rqstp to nfsctl.c
sunrpc: rename sunrpc_cache_pipe_upcall() to sunrpc_cache_upcall()
sunrpc: rename sunrpc_cache_pipe_upcall_timeout()
sunrpc: rename cache_pipe_upcall() to cache_do_upcall()
sunrpc: add a cache_notify callback
sunrpc: add helpers to count and snapshot pending cache requests
sunrpc: add a generic netlink family for cache upcalls
sunrpc: add netlink upcall for the auth.unix.ip cache
sunrpc: add netlink upcall for the auth.unix.gid cache
nfsd: add new netlink spec for svc_export upcall
nfsd: add netlink upcall for the svc_export cache
nfsd: add netlink upcall for the nfsd.fh cache
sunrpc: add SUNRPC_CMD_CACHE_FLUSH netlink command
nfsd: add NFSD_CMD_CACHE_FLUSH netlink command

Documentation/netlink/specs/nfsd.yaml | 239 +++++++++
Documentation/netlink/specs/sunrpc_cache.yaml | 149 ++++++
fs/nfs/dns_resolve.c | 2 +-
fs/nfsd/export.c | 707 +++++++++++++++++++++++++-
fs/nfsd/netlink.c | 109 +++-
fs/nfsd/netlink.h | 18 +
fs/nfsd/nfs4idmap.c | 4 +-
fs/nfsd/nfsctl.c | 75 +++
fs/nfsd/nfsd.h | 17 +-
include/linux/sunrpc/cache.h | 12 +-
include/uapi/linux/nfsd_netlink.h | 133 +++++
include/uapi/linux/sunrpc_netlink.h | 84 +++
net/sunrpc/Makefile | 2 +-
net/sunrpc/auth_gss/svcauth_gss.c | 2 +-
net/sunrpc/cache.c | 76 ++-
net/sunrpc/netlink.c | 144 ++++++
net/sunrpc/netlink.h | 38 ++
net/sunrpc/sunrpc_syms.c | 10 +
net/sunrpc/svcauth_unix.c | 506 +++++++++++++++++-
19 files changed, 2287 insertions(+), 40 deletions(-)
---
base-commit: e344b49528c8ef457ee714bb65e2da4c121132c2
change-id: 20260316-exportd-netlink-1c9fb52536e3

Best regards,
--
Jeff Layton <jlayton@xxxxxxxxxx>