Skip to content

Commit 1a867d7

Browse files
author
Al Viro
committed
__attach_mnt(): lose the second argument
It's always ->mnt_parent of the first one. What the function does is making a mount (with already set parent and mountpoint) visible - in mount hash and in the parent's list of children. IOW, it takes the existing rootwards linkage and sets the matching crownwards linkage. Renamed to make_visible(), while we are at it. Signed-off-by: Al Viro <[email protected]>
1 parent 9ed4b9e commit 1a867d7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

fs/namespace.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,8 +1079,9 @@ void mnt_set_mountpoint(struct mount *mnt,
10791079
hlist_add_head(&child_mnt->mnt_mp_list, &mp->m_list);
10801080
}
10811081

1082-
static void __attach_mnt(struct mount *mnt, struct mount *parent)
1082+
static void make_visible(struct mount *mnt)
10831083
{
1084+
struct mount *parent = mnt->mnt_parent;
10841085
if (unlikely(mnt->mnt_mountpoint == parent->mnt.mnt_root))
10851086
parent->overmount = mnt;
10861087
hlist_add_head_rcu(&mnt->mnt_hash,
@@ -1098,7 +1099,7 @@ static void __attach_mnt(struct mount *mnt, struct mount *parent)
10981099
* Mount @mnt at @mp on @parent. Then attach @mnt
10991100
* to @parent's child mount list and to @mount_hashtable.
11001101
*
1101-
* Note, when __attach_mnt() is called @mnt->mnt_parent already points
1102+
* Note, when make_visible() is called @mnt->mnt_parent already points
11021103
* to the correct parent.
11031104
*
11041105
* Context: This function expects namespace_lock() and lock_mount_hash()
@@ -1108,7 +1109,7 @@ static void attach_mnt(struct mount *mnt, struct mount *parent,
11081109
struct mountpoint *mp)
11091110
{
11101111
mnt_set_mountpoint(parent, mp, mnt);
1111-
__attach_mnt(mnt, mnt->mnt_parent);
1112+
make_visible(mnt);
11121113
}
11131114

11141115
void mnt_change_mountpoint(struct mount *parent, struct mountpoint *mp, struct mount *mnt)
@@ -1182,7 +1183,7 @@ static void commit_tree(struct mount *mnt)
11821183
n->nr_mounts += n->pending_mounts;
11831184
n->pending_mounts = 0;
11841185

1185-
__attach_mnt(mnt, parent);
1186+
make_visible(mnt);
11861187
touch_mnt_namespace(n);
11871188
}
11881189

@@ -2679,7 +2680,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
26792680
mnt_set_mountpoint(dest_mnt, dest_mp, source_mnt);
26802681
if (beneath)
26812682
mnt_change_mountpoint(top, smp, top_mnt);
2682-
__attach_mnt(source_mnt, source_mnt->mnt_parent);
2683+
make_visible(source_mnt);
26832684
mnt_notify_add(source_mnt);
26842685
touch_mnt_namespace(source_mnt->mnt_ns);
26852686
} else {

0 commit comments

Comments
 (0)