aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2025-05-01 19:59:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2025-06-29 18:13:42 -0400
commita8c764e1a580c2128e905ad6e42beef413fb7177 (patch)
tree84ecb0a8e402626596767ea5449ee80d4fd625a5 /fs/namespace.c
parentee1ee33ccc1ba0620a77833b2a3e320588701217 (diff)
downloadrandom-a8c764e1a580c2128e905ad6e42beef413fb7177.tar.gz
attach_recursive_mnt(): remove from expiry list on move
... rather than doing that in do_move_mount(). That's the main obstacle to moving the protection of ->mnt_expire from namespace_sem to mount_lock (spinlock-only), which would simplify several failure exits. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 7c7cc14da1ee2d..e8dc8af87548d7 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2684,6 +2684,9 @@ static int attach_recursive_mnt(struct mount *source_mnt,
if (moving) {
umount_mnt(source_mnt);
mnt_notify_add(source_mnt);
+ /* if the mount is moved, it should no longer be expired
+ * automatically */
+ list_del_init(&source_mnt->mnt_expire);
} else {
if (source_mnt->mnt_ns) {
LIST_HEAD(head);
@@ -3674,12 +3677,6 @@ static int do_move_mount(struct path *old_path,
goto out;
err = attach_recursive_mnt(old, p, mp);
- if (err)
- goto out;
-
- /* if the mount is moved, it should no longer be expire
- * automatically */
- list_del_init(&old->mnt_expire);
out:
unlock_mount(mp);
if (!err) {