Skip to content

Commit 94a8d00

Browse files
author
Al Viro
committed
turn do_make_slave() into transfer_propagation()
Lift calculation of replacement propagation source, removal from peer group and assignment of ->mnt_master from do_make_slave() into change_mnt_propagation() itself. What remains is switching of what used to get propagation *through* mnt to alternative source. Rename to transfer_propagation(), passing it the replacement source as the second argument. Have it return void, while we are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 955336e commit 94a8d00

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

fs/pnode.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,34 +83,23 @@ static struct mount *propagation_source(struct mount *mnt)
8383
return mnt;
8484
}
8585

86-
static int do_make_slave(struct mount *mnt)
86+
static void transfer_propagation(struct mount *mnt, struct mount *to)
8787
{
88-
struct mount *master = propagation_source(mnt);
8988
struct mount *slave_mnt;
90-
91-
if (list_empty(&mnt->mnt_share)) {
92-
mnt_release_group_id(mnt);
93-
} else {
94-
list_del_init(&mnt->mnt_share);
95-
mnt->mnt_group_id = 0;
96-
}
97-
CLEAR_MNT_SHARED(mnt);
98-
if (!master) {
89+
if (!to) {
9990
struct list_head *p = &mnt->mnt_slave_list;
10091
while (!list_empty(p)) {
10192
slave_mnt = list_first_entry(p,
10293
struct mount, mnt_slave);
10394
list_del_init(&slave_mnt->mnt_slave);
10495
slave_mnt->mnt_master = NULL;
10596
}
106-
return 0;
97+
return;
10798
}
10899
list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
109-
slave_mnt->mnt_master = master;
110-
list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
100+
slave_mnt->mnt_master = to;
101+
list_splice(&mnt->mnt_slave_list, to->mnt_slave_list.prev);
111102
INIT_LIST_HEAD(&mnt->mnt_slave_list);
112-
mnt->mnt_master = master;
113-
return 0;
114103
}
115104

116105
/*
@@ -122,8 +111,19 @@ void change_mnt_propagation(struct mount *mnt, int type)
122111
set_mnt_shared(mnt);
123112
return;
124113
}
125-
if (IS_MNT_SHARED(mnt))
126-
do_make_slave(mnt);
114+
if (IS_MNT_SHARED(mnt)) {
115+
struct mount *m = propagation_source(mnt);
116+
117+
if (list_empty(&mnt->mnt_share)) {
118+
mnt_release_group_id(mnt);
119+
} else {
120+
list_del_init(&mnt->mnt_share);
121+
mnt->mnt_group_id = 0;
122+
}
123+
CLEAR_MNT_SHARED(mnt);
124+
transfer_propagation(mnt, m);
125+
mnt->mnt_master = m;
126+
}
127127
list_del_init(&mnt->mnt_slave);
128128
if (type == MS_SLAVE) {
129129
if (mnt->mnt_master)

0 commit comments

Comments
 (0)