public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: NeilBrown <neil@brown.name>, Jeff Layton <jlayton@kernel.org>,
	 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: [PATCH v4 0/6] Automatic NFSv4 state revocation on filesystem unmount
Date: Wed, 18 Mar 2026 10:15:02 -0400	[thread overview]
Message-ID: <20260318-umount-kills-nfsv4-state-v4-0-56aad44ab982@oracle.com> (raw)

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_fs procfs
interface revokes all NFSv4 state on a given filesystem's
superblock, but it operates at whole-filesystem granularity and
offers no structured way to extend the operation to other scopes.

This series adds an NFSD_CMD_UNLOCK netlink command that supports
typed, validated attributes and multiple scope values. The
initial "ip" scope provides a netlink equivalent of
write_unlock_ip, releasing NLM locks held by a specific client
address. A "filesystem" scope parallels write_unlock_fs, accepting
a path string and revoking NFSv4 state, NLM locks, async COPY
operations, and cached file handles associated with that path.

The filesystem scope revokes state at export granularity rather
than superblock granularity: when multiple exports share a
filesystem, only state referencing files under the specified
export root is affected. The subtree check walks all dentry
aliases of each inode so that hard-linked files outside the
export are not incorrectly matched. When the export root is the
filesystem root, the subtree check is elided.

The exportfs user space command can invoke NFSD_CMD_UNLOCK with
the filesystem scope after an explicit "exportfs -u", enabling
automated state cleanup without custom scripting or manual
procfs writes.

---
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 (6):
      NFSD: Extract revoke_one_stid() utility function
      NFSD: Add NFSD_CMD_UNLOCK netlink command with ip scope
      NFSD: Add filesystem scope to NFSD_CMD_UNLOCK
      NFSD: Refactor find_one_sb_stid() into find_next_sb_stid()
      NFSD: Add export-scoped state revocation
      NFSD: Add nfsd_file_close_export() for file cache cleanup

 Documentation/netlink/specs/nfsd.yaml |  39 ++++++
 fs/nfsd/filecache.c                   |  77 ++++++++++++
 fs/nfsd/filecache.h                   |   2 +
 fs/nfsd/netlink.c                     |  14 +++
 fs/nfsd/netlink.h                     |   1 +
 fs/nfsd/nfs4state.c                   | 219 +++++++++++++++++++++-------------
 fs/nfsd/nfsctl.c                      | 105 +++++++++++++++-
 fs/nfsd/state.h                       |   7 ++
 fs/nfsd/trace.h                       |  13 +-
 include/uapi/linux/nfsd_netlink.h     |  19 +++
 10 files changed, 406 insertions(+), 90 deletions(-)
---
base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
change-id: 20260318-umount-kills-nfsv4-state-138218f2f4e0

Best regards,
--  
Chuck Lever


             reply	other threads:[~2026-03-18 14:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 14:15 Chuck Lever [this message]
2026-03-18 14:15 ` [PATCH v4 1/6] NFSD: Extract revoke_one_stid() utility function Chuck Lever
2026-03-18 14:21   ` Jeff Layton
2026-03-18 14:15 ` [PATCH v4 2/6] NFSD: Add NFSD_CMD_UNLOCK netlink command with ip scope Chuck Lever
2026-03-18 14:28   ` Jeff Layton
2026-03-18 14:32     ` Chuck Lever
2026-03-18 14:15 ` [PATCH v4 3/6] NFSD: Add filesystem scope to NFSD_CMD_UNLOCK Chuck Lever
2026-03-18 14:29   ` Jeff Layton
2026-03-18 14:15 ` [PATCH v4 4/6] NFSD: Refactor find_one_sb_stid() into find_next_sb_stid() Chuck Lever
2026-03-18 14:30   ` Jeff Layton
2026-03-18 14:15 ` [PATCH v4 5/6] NFSD: Add export-scoped state revocation Chuck Lever
2026-03-18 14:47   ` Jeff Layton
2026-03-18 14:51     ` Chuck Lever
2026-03-18 14:58       ` Jeff Layton
2026-03-18 17:57         ` Chuck Lever
2026-03-18 14:15 ` [PATCH v4 6/6] NFSD: Add nfsd_file_close_export() for file cache cleanup Chuck Lever
2026-03-18 14:24 ` [PATCH v4 0/6] Automatic NFSv4 state revocation on filesystem unmount 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=20260318-umount-kills-nfsv4-state-v4-0-56aad44ab982@oracle.com \
    --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