]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mnt: Don't propagate umounts in __detach_mounts
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 24 Dec 2014 13:35:10 +0000 (07:35 -0600)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:12:08 +0000 (19:12 -0400)
[ 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" <ebiederm@xmission.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/namespace.c

index 7ea7e51c7dc9f158b993d98f82096ed49f3305f6..07ba424181a5570209cdb9bd4d7841b64d0797d4 100644 (file)
@@ -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);