Skip to content

Commit 18959bf

Browse files
author
Al Viro
committed
attach_recursive_mnt(): pass destination mount in all cases
... and 'beneath' is no longer used there Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 96f5d2e commit 18959bf

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

fs/namespace.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,7 +2570,7 @@ enum mnt_tree_flags_t {
25702570
/**
25712571
* attach_recursive_mnt - attach a source mount tree
25722572
* @source_mnt: mount tree to be attached
2573-
* @top_mnt: mount that @source_mnt will be mounted on or mounted beneath
2573+
* @dest_mnt: mount that @source_mnt will be mounted on
25742574
* @dest_mp: the mountpoint @source_mnt will be mounted at
25752575
* @flags: modify how @source_mnt is supposed to be attached
25762576
*
@@ -2635,20 +2635,20 @@ enum mnt_tree_flags_t {
26352635
* Otherwise a negative error code is returned.
26362636
*/
26372637
static int attach_recursive_mnt(struct mount *source_mnt,
2638-
struct mount *top_mnt,
2638+
struct mount *dest_mnt,
26392639
struct mountpoint *dest_mp,
26402640
enum mnt_tree_flags_t flags)
26412641
{
26422642
struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns;
26432643
HLIST_HEAD(tree_list);
2644-
struct mnt_namespace *ns = top_mnt->mnt_ns;
2644+
struct mnt_namespace *ns = dest_mnt->mnt_ns;
26452645
struct mountpoint *smp;
26462646
struct mountpoint *shorter = NULL;
2647-
struct mount *child, *dest_mnt, *p;
2647+
struct mount *child, *p;
26482648
struct mount *top;
26492649
struct hlist_node *n;
26502650
int err = 0;
2651-
bool moving = flags & MNT_TREE_MOVE, beneath = flags & MNT_TREE_BENEATH;
2651+
bool moving = flags & MNT_TREE_MOVE;
26522652

26532653
/*
26542654
* Preallocate a mountpoint in case the new mounts need to be
@@ -2669,11 +2669,6 @@ static int attach_recursive_mnt(struct mount *source_mnt,
26692669
goto out;
26702670
}
26712671

2672-
if (beneath)
2673-
dest_mnt = top_mnt->mnt_parent;
2674-
else
2675-
dest_mnt = top_mnt;
2676-
26772672
if (IS_MNT_SHARED(dest_mnt)) {
26782673
err = invent_group_ids(source_mnt, true);
26792674
if (err)
@@ -3688,7 +3683,7 @@ static int do_move_mount(struct path *old_path,
36883683
if (mount_is_ancestor(old, p))
36893684
goto out;
36903685

3691-
err = attach_recursive_mnt(old, real_mount(new_path->mnt), mp, flags);
3686+
err = attach_recursive_mnt(old, p, mp, flags);
36923687
if (err)
36933688
goto out;
36943689

0 commit comments

Comments
 (0)