summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-21 10:14:08 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-03 12:02:37 -0700
commit92dbca18848fcc88661cd8a8ec17fd59ecc430cc (patch)
tree66be4a3bf17972ba89155ec1529298b00ce49f1b
parent12007ca282cf6f7636d029d61ae4223b59a08088 (diff)
downloadlwn-92dbca18848fcc88661cd8a8ec17fd59ecc430cc.tar.gz
lwn-92dbca18848fcc88661cd8a8ec17fd59ecc430cc.zip
don't bother with propagate_mnt() unless the target is shared
commit 0b1b901b5a98bb36943d10820efc796f7cd45ff3 upstream. If the dest_mnt is not shared, propagate_mnt() does nothing - there's no mounts to propagate to and thus no copies to create. Might as well don't bother calling it in that case. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/namespace.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index fd31a09a759c..284e15e8d7b6 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1653,16 +1653,14 @@ static int attach_recursive_mnt(struct mount *source_mnt,
err = invent_group_ids(source_mnt, true);
if (err)
goto out;
- }
- err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list);
- if (err)
- goto out_cleanup_ids;
-
- lock_mount_hash();
-
- if (IS_MNT_SHARED(dest_mnt)) {
+ err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list);
+ if (err)
+ goto out_cleanup_ids;
+ lock_mount_hash();
for (p = source_mnt; p; p = next_mnt(p, source_mnt))
set_mnt_shared(p);
+ } else {
+ lock_mount_hash();
}
if (parent_path) {
detach_mnt(source_mnt, parent_path);
@@ -1685,8 +1683,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
return 0;
out_cleanup_ids:
- if (IS_MNT_SHARED(dest_mnt))
- cleanup_group_ids(source_mnt, NULL);
+ cleanup_group_ids(source_mnt, NULL);
out:
return err;
}