Skip to content

Commit

Permalink
don't bother with propagate_mnt() unless the target is shared
Browse files Browse the repository at this point in the history
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: [email protected]
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Mar 30, 2014
1 parent 1d6a32a commit 0b1b901
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down

0 comments on commit 0b1b901

Please sign in to comment.