From: Chuck Lever <cel@kernel.org>
To: Jeff Layton <jlayton@kernel.org>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v5 0/7] Automatic NFSv4 state revocation on filesystem unmount
Date: Fri, 27 Mar 2026 09:29:40 -0400 [thread overview]
Message-ID: <68739c85-3964-4cee-aea5-cb625be42caf@kernel.org> (raw)
In-Reply-To: <5a77934e46108731495207230f51445ec07ac08c.camel@kernel.org>
On 3/27/26 8:03 AM, Jeff Layton wrote:
> On Thu, 2026-03-26 at 13:55 -0400, Chuck Lever wrote:
>> When an NFS server exports a filesystem and clients hold NFSv4
>> state (opens, locks, delegations), unmounting the underlying
>> filesystem fails with EBUSY. The /proc/fs/nfsd/unlock_ip and
>> /proc/fs/nfsd/unlock_fs procfs interfaces handle this, but have
>> no netlink equivalents, and unlock_fs operates at whole-superblock
>> granularity.
>>
>> This series adds three new NFSD netlink commands, each with its own
>> attribute set:
>>
>> - NFSD_CMD_UNLOCK_IP releases NLM locks held by a client IP
>> address. Netlink equivalent of write_unlock_ip.
>>
>> - NFSD_CMD_UNLOCK_FILESYSTEM revokes all NFS state on a
>> superblock. Netlink equivalent of write_unlock_fs.
>>
>> - NFSD_CMD_UNLOCK_EXPORT revokes NFSv4 state acquired through
>> exports of a specific path, regardless of client.
>>
>> UNLOCK_FILESYSTEM and UNLOCK_EXPORT serve different intents.
>> UNLOCK_FILESYSTEM means "unmounting /data, release everything
>> on this superblock." UNLOCK_EXPORT means "no clients remain for
>> /data/projectA, release only the state acquired through exports
>> of that path." Userspace (exportfs -u) sends UNLOCK_EXPORT after
>> removing the last client for a given path, enabling the underlying
>> filesystem to be unmounted.
>>
>> The path-only design for UNLOCK_EXPORT avoids the auth_domain
>> naming complexity (use_ipaddr vs hostname-based domains) by not
>> requiring the caller to identify a specific client. Since this
>> mechanism is to be used to enable umount, this seemed like a
>> reasonable compromise.
>>
>
> Can you comment a bit about your intentions with userland here? Do you
> plan to extend nfsdctl to add this support or add a new binary to nfs-
> utils? Do you have userland patches or is that still TBD?
I have a version of exportfs that performs the netlink UNLOCK command as
part of unexporting. There are some conditions where it skips this; for
example, when unexporting all before a shutdown, otherwise state
recovery doesn't work.
These new UNLOCK commands stand alone as a feature, even though they are
not the full solution for addressing the unmounting failure after an
export, so I didn't post the exportfs patch this time. I'm sure there
are some details about that logic/policy that will need more debate.
Someone could add the UNLOCK commands to nfsdctl, but that isn't a
requirement for this work.
>> ---
>> Changes since v4:
>> - 1/9 has been queued in nfsd-testing
>> - Split single NFSD_CMD_UNLOCK into three separate commands
>> - UNLOCK_EXPORT takes path only, no client attribute to avoid
>> auth_domain naming complexity with use_ipaddr
>>
>> Changes since v3:
>> - All VFS changes replaced with new netlink "unlock" operation
>>
>> Changes since v2:
>> - Replace fs_pin with an SRCU umount notifier chain in VFS
>> - Merge the pending COPY cancellation patch
>> - Replace xa_cmpxchg() with xa_insert()
>> - Use cancel_work_sync() instead of flush_workqueue()
>> - Remove rcu_barrier()
>> - Correct misleading claims in kdoc comments and commit messages
>>
>> Changes since v1:
>> - Explain why drop_client() is being renamed
>> - Finish implementing revocation on umount
>> - Rename pin_insert_group
>> - Clarified log output and code comments
>> - Hold nfsd_mutex while closing nfsd_files
>>
>> ---
>> Chuck Lever (7):
>> NFSD: Extract revoke_one_stid() utility function
>> NFSD: Add NFSD_CMD_UNLOCK_IP netlink command
>> NFSD: Add NFSD_CMD_UNLOCK_FILESYSTEM netlink command
>> NFSD: Replace idr_for_each_entry_ul in find_one_sb_stid()
>> NFSD: Track svc_export in nfs4_stid
>> NFSD: Add NFSD_CMD_UNLOCK_EXPORT netlink command
>> NFSD: Close cached file handles when revoking export state
>>
>> Documentation/netlink/specs/nfsd.yaml | 61 +++++++++
>> fs/nfsd/filecache.c | 46 +++++++
>> fs/nfsd/filecache.h | 1 +
>> fs/nfsd/netlink.c | 36 ++++++
>> fs/nfsd/netlink.h | 3 +
>> fs/nfsd/nfs4layouts.c | 2 +
>> fs/nfsd/nfs4state.c | 226 +++++++++++++++++++++++-----------
>> fs/nfsd/nfsctl.c | 126 ++++++++++++++++++-
>> fs/nfsd/state.h | 6 +
>> fs/nfsd/trace.h | 32 ++++-
>> include/uapi/linux/nfsd_netlink.h | 24 ++++
>> 11 files changed, 484 insertions(+), 79 deletions(-)
>> ---
>> base-commit: 65058e9e9b20619f920397f529072e853dd43811
>> change-id: 20260318-umount-kills-nfsv4-state-138218f2f4e0
>>
>> Best regards,
>> --
>> Chuck Lever
>
--
Chuck Lever
next prev parent reply other threads:[~2026-03-27 13:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 17:55 [PATCH v5 0/7] Automatic NFSv4 state revocation on filesystem unmount Chuck Lever
2026-03-26 17:55 ` [PATCH v5 1/7] NFSD: Extract revoke_one_stid() utility function Chuck Lever
2026-03-27 5:26 ` kernel test robot
2026-03-27 5:56 ` kernel test robot
2026-03-27 10:08 ` kernel test robot
2026-03-27 11:13 ` kernel test robot
2026-03-27 12:00 ` Jeff Layton
2026-03-27 12:21 ` Jeff Layton
2026-03-27 14:18 ` Chuck Lever
2026-03-26 17:55 ` [PATCH v5 2/7] NFSD: Add NFSD_CMD_UNLOCK_IP netlink command Chuck Lever
2026-03-27 12:06 ` Jeff Layton
2026-03-27 15:19 ` Chuck Lever
2026-03-27 15:52 ` Jeff Layton
2026-03-27 16:02 ` Chuck Lever
2026-03-26 17:55 ` [PATCH v5 3/7] NFSD: Add NFSD_CMD_UNLOCK_FILESYSTEM " Chuck Lever
2026-03-26 17:55 ` [PATCH v5 4/7] NFSD: Replace idr_for_each_entry_ul in find_one_sb_stid() Chuck Lever
2026-03-26 17:55 ` [PATCH v5 5/7] NFSD: Track svc_export in nfs4_stid Chuck Lever
2026-03-26 17:55 ` [PATCH v5 6/7] NFSD: Add NFSD_CMD_UNLOCK_EXPORT netlink command Chuck Lever
2026-03-26 17:55 ` [PATCH v5 7/7] NFSD: Close cached file handles when revoking export state Chuck Lever
2026-03-27 12:03 ` [PATCH v5 0/7] Automatic NFSv4 state revocation on filesystem unmount Jeff Layton
2026-03-27 13:29 ` Chuck Lever [this message]
2026-03-27 12:18 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=68739c85-3964-4cee-aea5-cb625be42caf@kernel.org \
--to=cel@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox