Commit 6fc7871f authored by Al Viro's avatar Al Viro

vfs: spread struct mount - get_dominating_id / do_make_slave

next pile of horrors, similar to mnt_parent one; this time it's
mnt_master.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 6b41d536
...@@ -1053,7 +1053,7 @@ static int show_mountinfo(struct seq_file *m, void *v) ...@@ -1053,7 +1053,7 @@ static int show_mountinfo(struct seq_file *m, void *v)
seq_printf(m, " shared:%i", mnt->mnt_group_id); seq_printf(m, " shared:%i", mnt->mnt_group_id);
if (IS_MNT_SLAVE(mnt)) { if (IS_MNT_SLAVE(mnt)) {
int master = mnt->mnt_master->mnt_group_id; int master = mnt->mnt_master->mnt_group_id;
int dom = get_dominating_id(mnt, &p->root); int dom = get_dominating_id(r, &p->root);
seq_printf(m, " master:%i", master); seq_printf(m, " master:%i", master);
if (dom && dom != master) if (dom && dom != master)
seq_printf(m, " propagate_from:%i", dom); seq_printf(m, " propagate_from:%i", dom);
......
...@@ -28,19 +28,19 @@ static inline struct vfsmount *next_slave(struct vfsmount *p) ...@@ -28,19 +28,19 @@ static inline struct vfsmount *next_slave(struct vfsmount *p)
return list_entry(p->mnt_slave.next, struct vfsmount, mnt_slave); return list_entry(p->mnt_slave.next, struct vfsmount, mnt_slave);
} }
static struct vfsmount *get_peer_under_root(struct vfsmount *mnt, static struct mount *get_peer_under_root(struct mount *mnt,
struct mnt_namespace *ns, struct mnt_namespace *ns,
const struct path *root) const struct path *root)
{ {
struct mount *m = real_mount(mnt); struct mount *m = mnt;
do { do {
/* Check the namespace first for optimization */ /* Check the namespace first for optimization */
if (m->mnt.mnt_ns == ns && is_path_reachable(m, m->mnt.mnt_root, root)) if (m->mnt.mnt_ns == ns && is_path_reachable(m, m->mnt.mnt_root, root))
return &m->mnt; return m;
m = real_mount(next_peer(&m->mnt)); m = real_mount(next_peer(&m->mnt));
} while (&m->mnt != mnt); } while (m != mnt);
return NULL; return NULL;
} }
...@@ -51,22 +51,22 @@ static struct vfsmount *get_peer_under_root(struct vfsmount *mnt, ...@@ -51,22 +51,22 @@ static struct vfsmount *get_peer_under_root(struct vfsmount *mnt,
* *
* Caller must hold namespace_sem * Caller must hold namespace_sem
*/ */
int get_dominating_id(struct vfsmount *mnt, const struct path *root) int get_dominating_id(struct mount *mnt, const struct path *root)
{ {
struct vfsmount *m; struct mount *m;
for (m = mnt->mnt_master; m != NULL; m = m->mnt_master) { for (m = real_mount(mnt->mnt.mnt_master); m != NULL; m = real_mount(m->mnt.mnt_master)) {
struct vfsmount *d = get_peer_under_root(m, mnt->mnt_ns, root); struct mount *d = get_peer_under_root(m, mnt->mnt.mnt_ns, root);
if (d) if (d)
return d->mnt_group_id; return d->mnt.mnt_group_id;
} }
return 0; return 0;
} }
static int do_make_slave(struct vfsmount *mnt) static int do_make_slave(struct mount *mnt)
{ {
struct vfsmount *peer_mnt = mnt, *master = mnt->mnt_master; struct mount *peer_mnt = mnt, *master = real_mount(mnt->mnt.mnt_master);
struct vfsmount *slave_mnt; struct vfsmount *slave_mnt;
/* /*
...@@ -74,31 +74,31 @@ static int do_make_slave(struct vfsmount *mnt) ...@@ -74,31 +74,31 @@ static int do_make_slave(struct vfsmount *mnt)
* same root dentry. If none is available then * same root dentry. If none is available then
* slave it to anything that is available. * slave it to anything that is available.
*/ */
while ((peer_mnt = next_peer(peer_mnt)) != mnt && while ((peer_mnt = real_mount(next_peer(&peer_mnt->mnt))) != mnt &&
peer_mnt->mnt_root != mnt->mnt_root) ; peer_mnt->mnt.mnt_root != mnt->mnt.mnt_root) ;
if (peer_mnt == mnt) { if (peer_mnt == mnt) {
peer_mnt = next_peer(mnt); peer_mnt = real_mount(next_peer(&mnt->mnt));
if (peer_mnt == mnt) if (peer_mnt == mnt)
peer_mnt = NULL; peer_mnt = NULL;
} }
if (IS_MNT_SHARED(mnt) && list_empty(&mnt->mnt_share)) if (IS_MNT_SHARED(&mnt->mnt) && list_empty(&mnt->mnt.mnt_share))
mnt_release_group_id(real_mount(mnt)); mnt_release_group_id(mnt);
list_del_init(&mnt->mnt_share); list_del_init(&mnt->mnt.mnt_share);
mnt->mnt_group_id = 0; mnt->mnt.mnt_group_id = 0;
if (peer_mnt) if (peer_mnt)
master = peer_mnt; master = peer_mnt;
if (master) { if (master) {
list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave) list_for_each_entry(slave_mnt, &mnt->mnt.mnt_slave_list, mnt_slave)
slave_mnt->mnt_master = master; slave_mnt->mnt_master = &master->mnt;
list_move(&mnt->mnt_slave, &master->mnt_slave_list); list_move(&mnt->mnt.mnt_slave, &master->mnt.mnt_slave_list);
list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev); list_splice(&mnt->mnt.mnt_slave_list, master->mnt.mnt_slave_list.prev);
INIT_LIST_HEAD(&mnt->mnt_slave_list); INIT_LIST_HEAD(&mnt->mnt.mnt_slave_list);
} else { } else {
struct list_head *p = &mnt->mnt_slave_list; struct list_head *p = &mnt->mnt.mnt_slave_list;
while (!list_empty(p)) { while (!list_empty(p)) {
slave_mnt = list_first_entry(p, slave_mnt = list_first_entry(p,
struct vfsmount, mnt_slave); struct vfsmount, mnt_slave);
...@@ -106,8 +106,8 @@ static int do_make_slave(struct vfsmount *mnt) ...@@ -106,8 +106,8 @@ static int do_make_slave(struct vfsmount *mnt)
slave_mnt->mnt_master = NULL; slave_mnt->mnt_master = NULL;
} }
} }
mnt->mnt_master = master; mnt->mnt.mnt_master = &master->mnt;
CLEAR_MNT_SHARED(mnt); CLEAR_MNT_SHARED(&mnt->mnt);
return 0; return 0;
} }
...@@ -120,7 +120,7 @@ void change_mnt_propagation(struct mount *mnt, int type) ...@@ -120,7 +120,7 @@ void change_mnt_propagation(struct mount *mnt, int type)
set_mnt_shared(mnt); set_mnt_shared(mnt);
return; return;
} }
do_make_slave(&mnt->mnt); do_make_slave(mnt);
if (type != MS_SLAVE) { if (type != MS_SLAVE) {
list_del_init(&mnt->mnt.mnt_slave); list_del_init(&mnt->mnt.mnt_slave);
mnt->mnt.mnt_master = NULL; mnt->mnt.mnt_master = NULL;
......
...@@ -35,7 +35,7 @@ int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *, ...@@ -35,7 +35,7 @@ int propagate_mnt(struct vfsmount *, struct dentry *, struct vfsmount *,
int propagate_umount(struct list_head *); int propagate_umount(struct list_head *);
int propagate_mount_busy(struct mount *, int); int propagate_mount_busy(struct mount *, int);
void mnt_release_group_id(struct mount *); void mnt_release_group_id(struct mount *);
int get_dominating_id(struct vfsmount *mnt, const struct path *root); int get_dominating_id(struct mount *mnt, const struct path *root);
unsigned int mnt_get_count(struct mount *mnt); unsigned int mnt_get_count(struct mount *mnt);
void mnt_set_mountpoint(struct vfsmount *, struct dentry *, void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
struct mount *); struct mount *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment