]> Pileus Git - ~andy/linux/commitdiff
don't bother with propagate_mnt() unless the target is shared
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 21 Mar 2014 14:14:08 +0000 (10:14 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 30 Mar 2014 23:18:50 +0000 (19:18 -0400)
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.

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c

index 9db3ce397a838bf9e52af3c2a00528bd07935727..d3fb9f00576e2a2e8c431b5936b4b3b571a74e7a 100644 (file)
@@ -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;
 }