Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b1b901b authored by Al Viro's avatar Al Viro
Browse files

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 1d6a32ac
Loading
Loading
Loading
Loading
+7 −10
Original line number Original line Diff line number Diff line
@@ -1653,16 +1653,14 @@ static int attach_recursive_mnt(struct mount *source_mnt,
		err = invent_group_ids(source_mnt, true);
		err = invent_group_ids(source_mnt, true);
		if (err)
		if (err)
			goto out;
			goto out;
	}
		err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list);
		err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list);
		if (err)
		if (err)
			goto out_cleanup_ids;
			goto out_cleanup_ids;

		lock_mount_hash();
		lock_mount_hash();

	if (IS_MNT_SHARED(dest_mnt)) {
		for (p = source_mnt; p; p = next_mnt(p, source_mnt))
		for (p = source_mnt; p; p = next_mnt(p, source_mnt))
			set_mnt_shared(p);
			set_mnt_shared(p);
	} else {
		lock_mount_hash();
	}
	}
	if (parent_path) {
	if (parent_path) {
		detach_mnt(source_mnt, parent_path);
		detach_mnt(source_mnt, parent_path);
@@ -1685,7 +1683,6 @@ static int attach_recursive_mnt(struct mount *source_mnt,
	return 0;
	return 0;


 out_cleanup_ids:
 out_cleanup_ids:
	if (IS_MNT_SHARED(dest_mnt))
	cleanup_group_ids(source_mnt, NULL);
	cleanup_group_ids(source_mnt, NULL);
 out:
 out:
	return err;
	return err;