take ->mnt_expire handling under mount_lock [read_seqlock_excl]
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 2 May 2025 00:40:57 +0000 (20:40 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 29 Jun 2025 22:13:42 +0000 (18:13 -0400)
commitec3265a245b22f8b8a0b20e04dd1d3f4f4a9ce09
treeba0191e8d8a4e352d6bc97ea2c1b8948762c7836
parenta8c764e1a580c2128e905ad6e42beef413fb7177
take ->mnt_expire handling under mount_lock [read_seqlock_excl]

Doesn't take much massage, and we no longer need to make sure that
by the time of final mntput() the victim has been removed from the
list.  Makes life safer for ->d_automount() instances...

Rules:
* all ->mnt_expire accesses are under mount_lock.
* insertion into the list is done by mnt_set_expiry(), and
caller (->d_automount() instance) must hold a reference to mount
in question.  It shouldn't be done more than once for a mount.
* if a mount on an expiry list is not yet mounted, it will
be ignored by anything that walks that list.
* if the final mntput() finds its victim still on an expiry
list (in which case it must've never been mounted - umount_tree()
would've taken it out), it will remove the victim from the list.

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c