[PATCH nfs-utils 14/17] nfsd/sunrpc: add cache flush command and attribute enums

Jeff Layton
2026-03-16T15:17:08Z

Add NFSD_CMD_CACHE_FLUSH and SUNRPC_CMD_CACHE_FLUSH command enums,
along with their corresponding NFSD_A_CACHE_FLUSH_MASK and
SUNRPC_A_CACHE_FLUSH_MASK attribute enums, to the UAPI netlink headers.

These correspond to new kernel netlink commands that allow userspace to
flush nfsd and sunrpc caches via generic netlink instead of writing to
/proc/net/rpc/*/flush. The mask attribute allows selective per-cache
flushing; omitting it flushes all caches in the family.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
support/include/nfsd_netlink.h | 8 ++++++++
support/include/sunrpc_netlink.h | 8 ++++++++
2 files changed, 16 insertions(+)

diff --git a/support/include/nfsd_netlink.h b/support/include/nfsd_netlink.h
index e96cc1d23366bce13624084fd476dda65aef140a..08b8a77179f88f596d482d7a2ec5c19ee98b2e77 100644
--- a/support/include/nfsd_netlink.h
+++ b/support/include/nfsd_netlink.h
@@ -198,6 +198,13 @@ enum {
NFSD_A_EXPKEY_REQS_MAX = (__NFSD_A_EXPKEY_REQS_MAX - 1)
};

+enum {
+ NFSD_A_CACHE_FLUSH_MASK = 1,
+
+ __NFSD_A_CACHE_FLUSH_MAX,
+ NFSD_A_CACHE_FLUSH_MAX = (__NFSD_A_CACHE_FLUSH_MAX - 1)
+};
+
enum {
NFSD_CMD_RPC_STATUS_GET = 1,
NFSD_CMD_THREADS_SET,
@@ -213,6 +220,7 @@ enum {
NFSD_CMD_SVC_EXPORT_SET_REQS,
NFSD_CMD_EXPKEY_GET_REQS,
NFSD_CMD_EXPKEY_SET_REQS,
+ NFSD_CMD_CACHE_FLUSH,

__NFSD_CMD_MAX,
NFSD_CMD_MAX = (__NFSD_CMD_MAX - 1)
diff --git a/support/include/sunrpc_netlink.h b/support/include/sunrpc_netlink.h
index 52c9aa3f19b6a218ec7d0518b58062beff11c774..8deef0fa11d4382a077ea2e8a4c55856376f1731 100644
--- a/support/include/sunrpc_netlink.h
+++ b/support/include/sunrpc_netlink.h
@@ -60,12 +60,20 @@ enum {
SUNRPC_A_UNIX_GID_REQS_MAX = (__SUNRPC_A_UNIX_GID_REQS_MAX - 1)
};

+enum {
+ SUNRPC_A_CACHE_FLUSH_MASK = 1,
+
+ __SUNRPC_A_CACHE_FLUSH_MAX,
+ SUNRPC_A_CACHE_FLUSH_MAX = (__SUNRPC_A_CACHE_FLUSH_MAX - 1)
+};
+
enum {
SUNRPC_CMD_CACHE_NOTIFY = 1,
SUNRPC_CMD_IP_MAP_GET_REQS,
SUNRPC_CMD_IP_MAP_SET_REQS,
SUNRPC_CMD_UNIX_GID_GET_REQS,
SUNRPC_CMD_UNIX_GID_SET_REQS,
+ SUNRPC_CMD_CACHE_FLUSH,

__SUNRPC_CMD_MAX,
SUNRPC_CMD_MAX = (__SUNRPC_CMD_MAX - 1)

--
2.53.0