From: Chuck Lever <cel@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.com>, NeilBrown <neilb@ownmail.net>,
Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Chuck Lever <chuck.lever@oracle.com>,
Christian Brauner <brauner@kernel.org>
Subject: Re: [PATCH v3 1/3] fs: add umount notifier chain for filesystem unmount notification
Date: Thu, 26 Feb 2026 08:27:00 -0500 [thread overview]
Message-ID: <1165a90b-acbf-4c0d-a7e3-3972eba0d35a@kernel.org> (raw)
In-Reply-To: <CAOQ4uxhEpf1p3agEF7_HBrhUeKz1Fb_yKAQ0Pjo0zztTJfMoXA@mail.gmail.com>
On 2/26/26 5:52 AM, Amir Goldstein wrote:
> On Thu, Feb 26, 2026 at 9:48 AM Christian Brauner <brauner@kernel.org> wrote:
>>
>> On Tue, Feb 24, 2026 at 11:39:06AM -0500, Chuck Lever wrote:
>>> From: Chuck Lever <chuck.lever@oracle.com>
>>>
>>> Kernel subsystems occasionally need notification when a filesystem
>>> is unmounted. Until now, the only mechanism available is the fs_pin
>>> infrastructure, which has limited adoption (only BSD process
>>> accounting uses it) and VFS maintainers consider it deprecated.
>>>
>>> Add an SRCU notifier chain that fires during mount teardown,
>>> following the pattern established by lease_notifier_chain in
>>> fs/locks.c. The notifier fires after processing stuck children but
>>> before fsnotify_vfsmount_delete(), at which point SB_ACTIVE is
>>> still set and the superblock remains fully accessible.
>
> Did you see commit 74bd284537b34 ("fsnotify: Shutdown fsnotify
> before destroying sb's dcache")?
>
> Does it make the fsnotify_sb_delete() hook an appropriate place
> for this cleanup?
>
> We could send an FS_UNMOUNT event on sb, the same way as we send
> it on inode in fsnotify_unmount_inodes().
>
>>
>> What I don't understand is why you need this per-mount especially
>> because you say above "when a filesystem is mounted. Could you explain
>> this in some more details, please?
>>
>
> The confusing thing is that FS_UNMOUNT/IN_UNMOUNT are sent
> for inotify when the sb is destroyed, not when the mount is unmounted.
>
> If we wanted we could also send FS_UNMOUNT in fsnotify_vfsmount_delete(),
> but that would be too confusing.
>
> I think the only reason that we did not add fanotify support for FAN_UNMOUNT
> is this name confusion, but there could be other reasons which I don't
> remember.
>
>> Also this should take namespaces into account somehow, right? As Al
>> correctly observed anything that does CLONE_NEWNS and inherits your
>> mountable will generate notifications. Like, if systemd spawns services,
>> if a container runtime start, if someone uses unshare you'll get
>> absolutely flooded with events. I'm pretty sure that is not what you
>> want and that is defo not what the VFS should do...
I agree with Al's earlier comment and have added some protection there
for the next revision of the series.
>> Another thing: These ad-hoc notifiers are horrific. So I'm pitching
>> another idea and I hope that Jan and Amir can tell me that this is
>> doable...
>>
>> Can we extend fsnotify so that it's possible for a filesystem to
>> register "internal watches" on relevant objects such as mounts and
>> superblocks and get notified and execute blocking stuff if needed.
>>
>
> You mean like nfsd_file_fsnotify_group? ;)
>
>> Then we don't have to add another set of custom notification mechanisms
>> but have it available in a single subsystem and uniformely available.
>>
>
> I don't see a problem with nfsd registering for FS_UNMOUNT
> event on sb (once we add it).
>
> As a matter of fact, I think that nfsd can already add an inode
> mark on the export root path for FS_UNMOUNT event.
There isn't much required here aside from getting a synchronous notice
that the final file system unmount is going on. I'm happy to try
whatever mechanism VFS maintainers are most comfortable with.
--
Chuck Lever
next prev parent reply other threads:[~2026-02-26 13:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 16:39 [PATCH v3 0/3] Automatic NFSv4 state revocation on filesystem unmount Chuck Lever
2026-02-24 16:39 ` [PATCH v3 1/3] fs: add umount notifier chain for filesystem unmount notification Chuck Lever
2026-02-26 8:48 ` Christian Brauner
2026-02-26 10:52 ` Amir Goldstein
2026-02-26 13:27 ` Chuck Lever [this message]
2026-02-26 13:32 ` Jan Kara
2026-02-27 15:10 ` Chuck Lever
2026-03-01 14:37 ` Amir Goldstein
2026-03-01 17:20 ` Chuck Lever
2026-03-01 18:09 ` Amir Goldstein
2026-03-01 18:19 ` Chuck Lever
2026-03-02 4:09 ` NeilBrown
2026-03-02 13:57 ` Chuck Lever
2026-03-02 15:26 ` Jan Kara
2026-03-02 17:10 ` Jeff Layton
2026-03-02 17:37 ` Jan Kara
2026-03-02 17:53 ` Jeff Layton
2026-03-04 13:17 ` Christian Brauner
2026-03-04 15:15 ` Chuck Lever
2026-03-02 20:46 ` NeilBrown
2026-03-02 17:01 ` Chuck Lever
2026-03-02 20:36 ` NeilBrown
2026-03-03 20:02 ` Chuck Lever
2026-03-03 21:23 ` NeilBrown
2026-03-03 22:50 ` Chuck Lever
2026-03-04 1:01 ` NeilBrown
2026-03-04 13:05 ` Christian Brauner
2026-02-24 16:39 ` [PATCH v3 2/3] nfsd: revoke NFSv4 state when filesystem is unmounted Chuck Lever
2026-02-24 16:39 ` [PATCH v3 3/3] nfsd: close cached files on filesystem unmount Chuck Lever
2026-02-24 17:14 ` [PATCH v3 0/3] Automatic NFSv4 state revocation " Al Viro
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=1165a90b-acbf-4c0d-a7e3-3972eba0d35a@kernel.org \
--to=cel@kernel.org \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jack@suse.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@ownmail.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.