ignatenkobrain / rpms / kernel

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