24d93b
From ba4666388f1a69487e0a64e3626564d37feef2c0 Mon Sep 17 00:00:00 2001
24d93b
From: "T.kabe" <kabe@>
24d93b
Date: Fri, 3 Mar 2017 14:29:26 +0900
24d93b
Subject: [PATCH 1/4] get rid of propagate_umount() mistakenly treating slaves as busy.
24d93b
24d93b
[upstream commit 88b368f27a094277143d8ecd5a056116f6a41520]
24d93b
Author: Al Viro <viro@zeniv.linux.org.uk>
24d93b
Date:   Mon Aug 18 15:09:26 2014 -0400
24d93b
24d93b
    get rid of propagate_umount() mistakenly treating slaves as busy.
24d93b
24d93b
    The check in __propagate_umount() ("has somebody explicitly mounted
24d93b
    something on that slave?") is done *before* taking the already doomed
24d93b
    victims out of the child lists.
24d93b
24d93b
    Cc: stable@vger.kernel.org
24d93b
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
24d93b
---
24d93b
 fs/namespace.c | 4 +++-
24d93b
 fs/pnode.c     | 4 +++-
24d93b
 2 files changed, 6 insertions(+), 2 deletions(-)
24d93b
24d93b
diff --git a/fs/namespace.c b/fs/namespace.c
24d93b
index 9440b6a..0053bfc 100644
24d93b
--- a/fs/namespace.c
24d93b
+++ b/fs/namespace.c
24d93b
@@ -1195,6 +1195,9 @@ void umount_tree(struct mount *mnt, int propagate)
24d93b
 	for (p = mnt; p; p = next_mnt(p, mnt))
24d93b
 		list_move(&p->mnt_hash, &tmp_list);
24d93b
 
24d93b
+	list_for_each_entry(p, &tmp_list, mnt_hash)
24d93b
+		list_del_init(&p->mnt_child);
24d93b
+
24d93b
 	if (propagate)
24d93b
 		propagate_umount(&tmp_list);
24d93b
 
24d93b
@@ -1203,7 +1206,6 @@ void umount_tree(struct mount *mnt, int propagate)
24d93b
 		list_del_init(&p->mnt_list);
24d93b
 		__touch_mnt_namespace(p->mnt_ns);
24d93b
 		p->mnt_ns = NULL;
24d93b
-		list_del_init(&p->mnt_child);
24d93b
 		if (mnt_has_parent(p)) {
24d93b
 			p->mnt_parent->mnt_ghosts++;
24d93b
 			put_mountpoint(p->mnt_mp);
24d93b
diff --git a/fs/pnode.c b/fs/pnode.c
24d93b
index 54bd043..983cf93 100644
24d93b
--- a/fs/pnode.c
24d93b
+++ b/fs/pnode.c
24d93b
@@ -390,8 +390,10 @@ static void __propagate_umount(struct mount *mnt)
24d93b
 		 * umount the child only if the child has no
24d93b
 		 * other children
24d93b
 		 */
24d93b
-		if (child && list_empty(&child->mnt_mounts))
24d93b
+		if (child && list_empty(&child->mnt_mounts)) {
24d93b
+			list_del_init(&child->mnt_child);
24d93b
 			list_move_tail(&child->mnt_hash, &mnt->mnt_hash);
24d93b
+		}
24d93b
 	}
24d93b
 }
24d93b
 
24d93b
-- 
24d93b
1.8.3.1
24d93b