]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
get rid of propagate_umount() mistakenly treating slaves as busy.
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 18 Aug 2014 19:09:26 +0000 (15:09 -0400)
committerZefan Li <lizefan@huawei.com>
Mon, 1 Dec 2014 10:02:21 +0000 (18:02 +0800)
commit 88b368f27a094277143d8ecd5a056116f6a41520 upstream.

The check in __propagate_umount() ("has somebody explicitly mounted
something on that slave?") is done *before* taking the already doomed
victims out of the child lists.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[lizf: Backported to 3.4:
 - adjust context
 - s/hlist_for_each_entry/list_for_each_entry/]
Signed-off-by: Zefan Li <lizefan@huawei.com>
fs/namespace.c
fs/pnode.c

index 4e465397e45609f6cca3532d2cc15f434b8841c5..2985879371ebc1dd7d25e4946b37ff40404aa826 100644 (file)
@@ -1066,6 +1066,9 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
        for (p = mnt; p; p = next_mnt(p, mnt))
                list_move(&p->mnt_hash, &tmp_list);
 
+       list_for_each_entry(p, &tmp_list, mnt_hash)
+               list_del_init(&p->mnt_child);
+
        if (propagate)
                propagate_umount(&tmp_list);
 
@@ -1076,7 +1079,6 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
                if (p->mnt_ns)
                        __mnt_make_shortterm(p);
                p->mnt_ns = NULL;
-               list_del_init(&p->mnt_child);
                if (mnt_has_parent(p)) {
                        p->mnt_parent->mnt_ghosts++;
                        dentry_reset_mounted(p->mnt_mountpoint);
index ab5fa9e1a79ac8277ac1cb51db6a92e55ba2c935..f61dcb4f994c1e55675c1583e1a64dfb917c8b44 100644 (file)
@@ -333,8 +333,10 @@ static void __propagate_umount(struct mount *mnt)
                 * umount the child only if the child has no
                 * other children
                 */
-               if (child && list_empty(&child->mnt_mounts))
+               if (child && list_empty(&child->mnt_mounts)) {
+                       list_del_init(&child->mnt_child);
                        list_move_tail(&child->mnt_hash, &mnt->mnt_hash);
+               }
        }
 }