diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-21 10:14:08 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-30 19:18:50 -0400 |
| commit | 0b1b901b5a98bb36943d10820efc796f7cd45ff3 (patch) | |
| tree | 72aa314fd3f3c37d152aba79b302b86ce7f6a1f6 | |
| parent | 1d6a32acd70ab18499829c0a9a5dbe2bace72a13 (diff) | |
don't bother with propagate_mnt() unless the target is shared
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>
| -rw-r--r-- | fs/namespace.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 9db3ce397a83..d3fb9f00576e 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
| @@ -1653,16 +1653,14 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
| 1653 | err = invent_group_ids(source_mnt, true); | 1653 | err = invent_group_ids(source_mnt, true); |
| 1654 | if (err) | 1654 | if (err) |
| 1655 | goto out; | 1655 | goto out; |
| 1656 | } | 1656 | err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list); |
| 1657 | err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list); | 1657 | if (err) |
| 1658 | if (err) | 1658 | goto out_cleanup_ids; |
| 1659 | goto out_cleanup_ids; | 1659 | lock_mount_hash(); |
| 1660 | |||
| 1661 | lock_mount_hash(); | ||
| 1662 | |||
| 1663 | if (IS_MNT_SHARED(dest_mnt)) { | ||
| 1664 | for (p = source_mnt; p; p = next_mnt(p, source_mnt)) | 1660 | for (p = source_mnt; p; p = next_mnt(p, source_mnt)) |
| 1665 | set_mnt_shared(p); | 1661 | set_mnt_shared(p); |
| 1662 | } else { | ||
| 1663 | lock_mount_hash(); | ||
| 1666 | } | 1664 | } |
| 1667 | if (parent_path) { | 1665 | if (parent_path) { |
| 1668 | detach_mnt(source_mnt, parent_path); | 1666 | detach_mnt(source_mnt, parent_path); |
| @@ -1685,8 +1683,7 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
| 1685 | return 0; | 1683 | return 0; |
| 1686 | 1684 | ||
| 1687 | out_cleanup_ids: | 1685 | out_cleanup_ids: |
| 1688 | if (IS_MNT_SHARED(dest_mnt)) | 1686 | cleanup_group_ids(source_mnt, NULL); |
| 1689 | cleanup_group_ids(source_mnt, NULL); | ||
| 1690 | out: | 1687 | out: |
| 1691 | return err; | 1688 | return err; |
| 1692 | } | 1689 | } |
