This version should address most of Chuck's review comments. The
userland patch series is unchanged. I've added the netdev folks this
time too in order to get more experienced eyes on the netlink bits.
Original cover letter follows:
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@kernel.org>
---
Changes in v2:
- Reword comment above cache_do_upcall()
- Delay adding include of genetlink.h until needed
- Implement proper netlink dump continuation support in all downcalls
- Only ->cache_notify if request is still PENDING
- Add comments to svc_export netlink flag enums
- Shrink size passed to genlmsg_new for notify requests to sizeof(u32)
- move nfsd_cache_notify() out of autogenerated file
- Link to v1: https://lore.kernel.org/r/20260316-exportd-netlink-v1-0-6125dc62b955@kernel.org
---
Jeff Layton (13):
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 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 | 241 +++++++++
Documentation/netlink/specs/sunrpc_cache.yaml | 149 ++++++
fs/nfs/dns_resolve.c | 2 +-
fs/nfsd/export.c | 713 +++++++++++++++++++++++++-
fs/nfsd/netlink.c | 107 ++++
fs/nfsd/netlink.h | 18 +
fs/nfsd/nfs4idmap.c | 4 +-
fs/nfsd/nfsctl.c | 79 +++
fs/nfsd/nfsd.h | 17 +-
include/linux/sunrpc/cache.h | 15 +-
include/uapi/linux/nfsd_netlink.h | 141 +++++
include/uapi/linux/sunrpc_netlink.h | 84 +++
net/sunrpc/Makefile | 2 +-
net/sunrpc/auth_gss/svcauth_gss.c | 2 +-
net/sunrpc/cache.c | 127 ++++-
net/sunrpc/netlink.c | 111 ++++
net/sunrpc/netlink.h | 35 ++
net/sunrpc/sunrpc_syms.c | 10 +
net/sunrpc/svcauth_unix.c | 516 ++++++++++++++++++-
19 files changed, 2332 insertions(+), 41 deletions(-)
---
base-commit: e111174758bddc84136446ae283c741d855c7f8f
change-id: 20260316-exportd-netlink-1c9fb52536e3
Best regards,
--
Jeff Layton <jlayton@kernel.org>