From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp1040.oracle.com ([156.151.31.81]:39607 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753910AbbEKL13 (ORCPT ); Mon, 11 May 2015 07:27:29 -0400 From: Sasha Levin To: stable@vger.kernel.org, stable-commits@vger.kernel.org Cc: "Eric W. Biederman" , Sasha Levin Subject: [added to the 3.18 stable tree] mnt: Don't propagate umounts in __detach_mounts Date: Mon, 11 May 2015 07:18:05 -0400 Message-Id: <1431343152-19437-104-git-send-email-sasha.levin@oracle.com> In-Reply-To: <1431343152-19437-1-git-send-email-sasha.levin@oracle.com> References: <1431343152-19437-1-git-send-email-sasha.levin@oracle.com> Sender: stable-owner@vger.kernel.org List-ID: From: "Eric W. Biederman" This patch has been added to the 3.18 stable tree. If you have any objections, please let us know. =============== [ Upstream commit 8318e667f176f7ea34451a1a530634e293f216ac ] 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" Signed-off-by: Sasha Levin --- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namespace.c b/fs/namespace.c index 7ea7e51..07ba424 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1496,7 +1496,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.1.0