mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git
synced 2026-04-05 00:08:32 -04:00
mnt_slave_list/mnt_slave: turn into hlist_head/hlist_node
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -69,8 +69,8 @@ struct mount {
|
||||
struct list_head mnt_list;
|
||||
struct list_head mnt_expire; /* link in fs-specific expiry list */
|
||||
struct list_head mnt_share; /* circular list of shared mounts */
|
||||
struct list_head mnt_slave_list;/* list of slave mounts */
|
||||
struct list_head mnt_slave; /* slave list entry */
|
||||
struct hlist_head mnt_slave_list;/* list of slave mounts */
|
||||
struct hlist_node mnt_slave; /* slave list entry */
|
||||
struct mount *mnt_master; /* slave is on master->mnt_slave_list */
|
||||
struct mnt_namespace *mnt_ns; /* containing namespace */
|
||||
struct mountpoint *mnt_mp; /* where is it mounted */
|
||||
|
||||
@@ -380,8 +380,8 @@ static struct mount *alloc_vfsmnt(const char *name)
|
||||
INIT_LIST_HEAD(&mnt->mnt_list);
|
||||
INIT_LIST_HEAD(&mnt->mnt_expire);
|
||||
INIT_LIST_HEAD(&mnt->mnt_share);
|
||||
INIT_LIST_HEAD(&mnt->mnt_slave_list);
|
||||
INIT_LIST_HEAD(&mnt->mnt_slave);
|
||||
INIT_HLIST_HEAD(&mnt->mnt_slave_list);
|
||||
INIT_HLIST_NODE(&mnt->mnt_slave);
|
||||
INIT_HLIST_NODE(&mnt->mnt_mp_list);
|
||||
INIT_HLIST_HEAD(&mnt->mnt_stuck_children);
|
||||
RB_CLEAR_NODE(&mnt->mnt_node);
|
||||
@@ -1348,10 +1348,10 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
|
||||
|
||||
if ((flag & CL_SLAVE) ||
|
||||
((flag & CL_SHARED_TO_SLAVE) && IS_MNT_SHARED(old))) {
|
||||
list_add(&mnt->mnt_slave, &old->mnt_slave_list);
|
||||
hlist_add_head(&mnt->mnt_slave, &old->mnt_slave_list);
|
||||
mnt->mnt_master = old;
|
||||
} else if (IS_MNT_SLAVE(old)) {
|
||||
list_add(&mnt->mnt_slave, &old->mnt_slave);
|
||||
hlist_add_behind(&mnt->mnt_slave, &old->mnt_slave);
|
||||
mnt->mnt_master = old->mnt_master;
|
||||
}
|
||||
return mnt;
|
||||
@@ -3398,10 +3398,8 @@ static int do_set_group(struct path *from_path, struct path *to_path)
|
||||
goto out;
|
||||
|
||||
if (IS_MNT_SLAVE(from)) {
|
||||
struct mount *m = from->mnt_master;
|
||||
|
||||
list_add(&to->mnt_slave, &from->mnt_slave);
|
||||
to->mnt_master = m;
|
||||
hlist_add_behind(&to->mnt_slave, &from->mnt_slave);
|
||||
to->mnt_master = from->mnt_master;
|
||||
}
|
||||
|
||||
if (IS_MNT_SHARED(from)) {
|
||||
|
||||
41
fs/pnode.c
41
fs/pnode.c
@@ -21,12 +21,12 @@ static inline struct mount *next_peer(struct mount *p)
|
||||
|
||||
static inline struct mount *first_slave(struct mount *p)
|
||||
{
|
||||
return list_entry(p->mnt_slave_list.next, struct mount, mnt_slave);
|
||||
return hlist_entry(p->mnt_slave_list.first, struct mount, mnt_slave);
|
||||
}
|
||||
|
||||
static inline struct mount *next_slave(struct mount *p)
|
||||
{
|
||||
return list_entry(p->mnt_slave.next, struct mount, mnt_slave);
|
||||
return hlist_entry(p->mnt_slave.next, struct mount, mnt_slave);
|
||||
}
|
||||
|
||||
static struct mount *get_peer_under_root(struct mount *mnt,
|
||||
@@ -85,21 +85,18 @@ static struct mount *propagation_source(struct mount *mnt)
|
||||
|
||||
static void transfer_propagation(struct mount *mnt, struct mount *to)
|
||||
{
|
||||
struct mount *slave_mnt;
|
||||
if (!to) {
|
||||
struct list_head *p = &mnt->mnt_slave_list;
|
||||
while (!list_empty(p)) {
|
||||
slave_mnt = list_first_entry(p,
|
||||
struct mount, mnt_slave);
|
||||
list_del_init(&slave_mnt->mnt_slave);
|
||||
slave_mnt->mnt_master = NULL;
|
||||
}
|
||||
return;
|
||||
struct hlist_node *p = NULL, *n;
|
||||
struct mount *m;
|
||||
|
||||
hlist_for_each_entry_safe(m, n, &mnt->mnt_slave_list, mnt_slave) {
|
||||
m->mnt_master = to;
|
||||
if (!to)
|
||||
hlist_del_init(&m->mnt_slave);
|
||||
else
|
||||
p = &m->mnt_slave;
|
||||
}
|
||||
list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
|
||||
slave_mnt->mnt_master = to;
|
||||
list_splice(&mnt->mnt_slave_list, to->mnt_slave_list.prev);
|
||||
INIT_LIST_HEAD(&mnt->mnt_slave_list);
|
||||
if (p)
|
||||
hlist_splice_init(&mnt->mnt_slave_list, p, &to->mnt_slave_list);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -124,10 +121,10 @@ void change_mnt_propagation(struct mount *mnt, int type)
|
||||
transfer_propagation(mnt, m);
|
||||
mnt->mnt_master = m;
|
||||
}
|
||||
list_del_init(&mnt->mnt_slave);
|
||||
hlist_del_init(&mnt->mnt_slave);
|
||||
if (type == MS_SLAVE) {
|
||||
if (mnt->mnt_master)
|
||||
list_add(&mnt->mnt_slave,
|
||||
hlist_add_head(&mnt->mnt_slave,
|
||||
&mnt->mnt_master->mnt_slave_list);
|
||||
} else {
|
||||
mnt->mnt_master = NULL;
|
||||
@@ -147,7 +144,7 @@ static struct mount *__propagation_next(struct mount *m,
|
||||
if (master == origin->mnt_master) {
|
||||
struct mount *next = next_peer(m);
|
||||
return (next == origin) ? NULL : next;
|
||||
} else if (m->mnt_slave.next != &master->mnt_slave_list)
|
||||
} else if (m->mnt_slave.next)
|
||||
return next_slave(m);
|
||||
|
||||
/* back at master */
|
||||
@@ -169,7 +166,7 @@ static struct mount *propagation_next(struct mount *m,
|
||||
struct mount *origin)
|
||||
{
|
||||
/* are there any slaves of this mount? */
|
||||
if (!IS_MNT_NEW(m) && !list_empty(&m->mnt_slave_list))
|
||||
if (!IS_MNT_NEW(m) && !hlist_empty(&m->mnt_slave_list))
|
||||
return first_slave(m);
|
||||
|
||||
return __propagation_next(m, origin);
|
||||
@@ -194,7 +191,7 @@ static struct mount *next_group(struct mount *m, struct mount *origin)
|
||||
while (1) {
|
||||
while (1) {
|
||||
struct mount *next;
|
||||
if (!IS_MNT_NEW(m) && !list_empty(&m->mnt_slave_list))
|
||||
if (!IS_MNT_NEW(m) && !hlist_empty(&m->mnt_slave_list))
|
||||
return first_slave(m);
|
||||
next = next_peer(m);
|
||||
if (m->mnt_group_id == origin->mnt_group_id) {
|
||||
@@ -207,7 +204,7 @@ static struct mount *next_group(struct mount *m, struct mount *origin)
|
||||
/* m is the last peer */
|
||||
while (1) {
|
||||
struct mount *master = m->mnt_master;
|
||||
if (m->mnt_slave.next != &master->mnt_slave_list)
|
||||
if (m->mnt_slave.next)
|
||||
return next_slave(m);
|
||||
m = next_peer(master);
|
||||
if (master->mnt_group_id == origin->mnt_group_id)
|
||||
|
||||
Reference in New Issue
Block a user