From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric W. Biederman" Subject: [PATCH review 02/11] mnt: Don't propagate umounts in __detach_mounts Date: Mon, 5 Jan 2015 14:46:18 -0600 Message-ID: <1420490787-14387-2-git-send-email-ebiederm@xmission.com> References: <87mw5xq7lt.fsf@x220.int.ebiederm.org> Cc: , "Serge E. Hallyn" , Andy Lutomirski , Chen Hanxiao , Richard Weinberger , Andrey Vagin , Al Viro To: Linux Containers Return-path: Received: from out02.mta.xmission.com ([166.70.13.232]:59027 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752802AbbAEUtK (ORCPT ); Mon, 5 Jan 2015 15:49:10 -0500 In-Reply-To: <87mw5xq7lt.fsf@x220.int.ebiederm.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Invoking mount propagation from __detach_mounts is inefficient and wrong. It is inefficient because __detach_mounts already walks the list of mounts that where something needs to be done, and mount propagation walks some subset of those mounts again. It is actively wrong because if the dentry that is passed to __detach_mounts is not part of the path to a mount that mount should not be affected. change_mnt_propagation(p,MS_PRIVATE) modifies the mount propagation tree of a master mount so it's slaves are connected to another master if possible. Which means even removing a mount from the middle of a mount tree with __detach_mounts will not deprive any mount propagated mount events. Cc: stable@vger.kernel.org Signed-off-by: "Eric W. Biederman" --- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namespace.c b/fs/namespace.c index 5bb96c440b31..07d0562290a5 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1497,7 +1497,7 @@ void __detach_mounts(struct dentry *dentry) lock_mount_hash(); while (!hlist_empty(&mp->m_list)) { mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list); - umount_tree(mnt, UMOUNT_PROPAGATE); + umount_tree(mnt, 0); } unlock_mount_hash(); put_mountpoint(mp); -- 2.2.1