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>

Al Viro 0b1b901b 1d6a32ac

Changed files
+7 -10
fs
+7 -10
fs/namespace.c
··· 1653 1653 err = invent_group_ids(source_mnt, true); 1654 1654 if (err) 1655 1655 goto out; 1656 - } 1657 - err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list); 1658 - if (err) 1659 - goto out_cleanup_ids; 1660 - 1661 - lock_mount_hash(); 1662 - 1663 - if (IS_MNT_SHARED(dest_mnt)) { 1656 + err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list); 1657 + if (err) 1658 + goto out_cleanup_ids; 1659 + lock_mount_hash(); 1664 1660 for (p = source_mnt; p; p = next_mnt(p, source_mnt)) 1665 1661 set_mnt_shared(p); 1662 + } else { 1663 + lock_mount_hash(); 1666 1664 } 1667 1665 if (parent_path) { 1668 1666 detach_mnt(source_mnt, parent_path); ··· 1683 1685 return 0; 1684 1686 1685 1687 out_cleanup_ids: 1686 - if (IS_MNT_SHARED(dest_mnt)) 1687 - cleanup_group_ids(source_mnt, NULL); 1688 + cleanup_group_ids(source_mnt, NULL); 1688 1689 out: 1689 1690 return err; 1690 1691 }