Skip to content

Commit da025cd

Browse files
author
Al Viro
committed
propagate_umount(): only surviving overmounts should be reparented
... as the comments in reparent() clearly say. As it is, we reparent *all* overmounts of the mounts being taken out, including those that are taken out themselves. It's not only a potentially massive slowdown (on a pathological setup we might end up with O(N^2) time for N mounts being kicked out), it can end up with incorrect ->overmount in the surviving mounts. Fixes: f0d0ba1 "Rewrite of propagate_umount()" Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 0ddfb62 commit da025cd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/pnode.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,11 @@ void propagate_umount(struct list_head *set)
637637
}
638638

639639
// now to_umount consists of all acceptable candidates
640-
// deal with reparenting of remaining overmounts on those
640+
// deal with reparenting of surviving overmounts on those
641641
list_for_each_entry(m, &to_umount, mnt_list) {
642-
if (m->overmount)
643-
reparent(m->overmount);
642+
struct mount *over = m->overmount;
643+
if (over && !will_be_unmounted(over))
644+
reparent(over);
644645
}
645646

646647
// and fold them into the set

0 commit comments

Comments
 (0)