]> git.ipfire.org Git - thirdparty/linux.git/commit
NFSD: Add NFSD_CMD_UNLOCK_EXPORT netlink command
authorChuck Lever <chuck.lever@oracle.com>
Sun, 19 Apr 2026 18:53:06 +0000 (14:53 -0400)
committerChuck Lever <cel@kernel.org>
Tue, 9 Jun 2026 20:32:59 +0000 (16:32 -0400)
commit2eac189bb059d31a29937b29ee0f477394198610
treebde44a2d3750582f6c84bee20cd0429ded8aa80d
parentba0cde5dc81d214684b8ea0bd87414ba2f48fe02
NFSD: Add NFSD_CMD_UNLOCK_EXPORT netlink command

When a filesystem is exported to NFS clients, NFSv4 state
(opens, locks, delegations, layouts) holds references that
prevent the underlying filesystem from being unmounted.
NFSD_CMD_UNLOCK_FILESYSTEM addresses this at superblock
granularity, but administrators unexporting a single path on a
shared filesystem (e.g., one of several exports on the same device)
need finer control.

Add NFSD_CMD_UNLOCK_EXPORT, which revokes NFSv4 state acquired
through exports of a specific path.  Matching is by path identity
(dentry + vfsmount) via the sc_export field on each nfs4_stid,
so multiple svc_export objects for the same path -- one per
auth_domain -- are handled correctly without requiring the caller
to name a specific client.

The command takes a single "path" attribute.  Userspace (exportfs
-u) sends this after removing the last client for a given path,
enabling the underlying filesystem to be unmounted.  When multiple
clients share an export path, individual unexports do not trigger
state revocation; only the final one does.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Tested-by: Dai Ngo <dai.ngo@oracle.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Documentation/netlink/specs/nfsd.yaml
fs/nfsd/netlink.c
fs/nfsd/netlink.h
fs/nfsd/nfs4state.c
fs/nfsd/nfsctl.c
fs/nfsd/state.h
fs/nfsd/trace.h
include/uapi/linux/nfsd_netlink.h