aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-25 00:07:16 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:57:08 -0500
commitd10e8def07fc87488c396d2eff2c26c43bb541dd (patch)
treed0ad0d4c47838a096aafac353e206861cb6d62c1
parent14cf1fa8f54353d9caf6174c1e4280c8c4dcfd7a (diff)
vfs: take mnt_master to struct mount
make IS_MNT_SLAVE take struct mount * at the same time Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/mount.h2
-rw-r--r--fs/namespace.c10
-rw-r--r--fs/pnode.c26
-rw-r--r--include/linux/mount.h1
4 files changed, 20 insertions, 19 deletions
diff --git a/fs/mount.h b/fs/mount.h
index e4ecf59c9353..7071d8fa9307 100644
--- a/fs/mount.h
+++ b/fs/mount.h
@@ -19,6 +19,8 @@ struct mount {
19#endif 19#endif
20 struct list_head mnt_mounts; /* list of children, anchored here */ 20 struct list_head mnt_mounts; /* list of children, anchored here */
21 struct list_head mnt_child; /* and going through their mnt_child */ 21 struct list_head mnt_child; /* and going through their mnt_child */
22 /* yet to be moved - up to mnt_slave */
23 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
22}; 24};
23 25
24static inline struct mount *real_mount(struct vfsmount *mnt) 26static inline struct mount *real_mount(struct vfsmount *mnt)
diff --git a/fs/namespace.c b/fs/namespace.c
index ee42e671afdc..3439042fc9f2 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -715,14 +715,14 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
715 715
716 if (flag & CL_SLAVE) { 716 if (flag & CL_SLAVE) {
717 list_add(&mnt->mnt.mnt_slave, &old->mnt.mnt_slave_list); 717 list_add(&mnt->mnt.mnt_slave, &old->mnt.mnt_slave_list);
718 mnt->mnt.mnt_master = &old->mnt; 718 mnt->mnt_master = &old->mnt;
719 CLEAR_MNT_SHARED(&mnt->mnt); 719 CLEAR_MNT_SHARED(&mnt->mnt);
720 } else if (!(flag & CL_PRIVATE)) { 720 } else if (!(flag & CL_PRIVATE)) {
721 if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(&old->mnt)) 721 if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(&old->mnt))
722 list_add(&mnt->mnt.mnt_share, &old->mnt.mnt_share); 722 list_add(&mnt->mnt.mnt_share, &old->mnt.mnt_share);
723 if (IS_MNT_SLAVE(&old->mnt)) 723 if (IS_MNT_SLAVE(old))
724 list_add(&mnt->mnt.mnt_slave, &old->mnt.mnt_slave); 724 list_add(&mnt->mnt.mnt_slave, &old->mnt.mnt_slave);
725 mnt->mnt.mnt_master = old->mnt.mnt_master; 725 mnt->mnt_master = old->mnt_master;
726 } 726 }
727 if (flag & CL_MAKE_SHARED) 727 if (flag & CL_MAKE_SHARED)
728 set_mnt_shared(mnt); 728 set_mnt_shared(mnt);
@@ -1051,8 +1051,8 @@ static int show_mountinfo(struct seq_file *m, void *v)
1051 /* Tagged fields ("foo:X" or "bar") */ 1051 /* Tagged fields ("foo:X" or "bar") */
1052 if (IS_MNT_SHARED(mnt)) 1052 if (IS_MNT_SHARED(mnt))
1053 seq_printf(m, " shared:%i", mnt->mnt_group_id); 1053 seq_printf(m, " shared:%i", mnt->mnt_group_id);
1054 if (IS_MNT_SLAVE(mnt)) { 1054 if (IS_MNT_SLAVE(r)) {
1055 int master = mnt->mnt_master->mnt_group_id; 1055 int master = r->mnt_master->mnt_group_id;
1056 int dom = get_dominating_id(r, &p->root); 1056 int dom = get_dominating_id(r, &p->root);
1057 seq_printf(m, " master:%i", master); 1057 seq_printf(m, " master:%i", master);
1058 if (dom && dom != master) 1058 if (dom && dom != master)
diff --git a/fs/pnode.c b/fs/pnode.c
index 0e1de28b1b2e..3ac44d15fe58 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -55,7 +55,7 @@ int get_dominating_id(struct mount *mnt, const struct path *root)
55{ 55{
56 struct mount *m; 56 struct mount *m;
57 57
58 for (m = real_mount(mnt->mnt.mnt_master); m != NULL; m = real_mount(m->mnt.mnt_master)) { 58 for (m = real_mount(mnt->mnt_master); m != NULL; m = real_mount(m->mnt_master)) {
59 struct mount *d = get_peer_under_root(m, mnt->mnt.mnt_ns, root); 59 struct mount *d = get_peer_under_root(m, mnt->mnt.mnt_ns, root);
60 if (d) 60 if (d)
61 return d->mnt.mnt_group_id; 61 return d->mnt.mnt_group_id;
@@ -66,8 +66,8 @@ int get_dominating_id(struct mount *mnt, const struct path *root)
66 66
67static int do_make_slave(struct mount *mnt) 67static int do_make_slave(struct mount *mnt)
68{ 68{
69 struct mount *peer_mnt = mnt, *master = real_mount(mnt->mnt.mnt_master); 69 struct mount *peer_mnt = mnt, *master = real_mount(mnt->mnt_master);
70 struct vfsmount *slave_mnt; 70 struct mount *slave_mnt;
71 71
72 /* 72 /*
73 * slave 'mnt' to a peer mount that has the 73 * slave 'mnt' to a peer mount that has the
@@ -92,7 +92,7 @@ static int do_make_slave(struct mount *mnt)
92 master = peer_mnt; 92 master = peer_mnt;
93 93
94 if (master) { 94 if (master) {
95 list_for_each_entry(slave_mnt, &mnt->mnt.mnt_slave_list, mnt_slave) 95 list_for_each_entry(slave_mnt, &mnt->mnt.mnt_slave_list, mnt.mnt_slave)
96 slave_mnt->mnt_master = &master->mnt; 96 slave_mnt->mnt_master = &master->mnt;
97 list_move(&mnt->mnt.mnt_slave, &master->mnt.mnt_slave_list); 97 list_move(&mnt->mnt.mnt_slave, &master->mnt.mnt_slave_list);
98 list_splice(&mnt->mnt.mnt_slave_list, master->mnt.mnt_slave_list.prev); 98 list_splice(&mnt->mnt.mnt_slave_list, master->mnt.mnt_slave_list.prev);
@@ -101,12 +101,12 @@ static int do_make_slave(struct mount *mnt)
101 struct list_head *p = &mnt->mnt.mnt_slave_list; 101 struct list_head *p = &mnt->mnt.mnt_slave_list;
102 while (!list_empty(p)) { 102 while (!list_empty(p)) {
103 slave_mnt = list_first_entry(p, 103 slave_mnt = list_first_entry(p,
104 struct vfsmount, mnt_slave); 104 struct mount, mnt.mnt_slave);
105 list_del_init(&slave_mnt->mnt_slave); 105 list_del_init(&slave_mnt->mnt.mnt_slave);
106 slave_mnt->mnt_master = NULL; 106 slave_mnt->mnt_master = NULL;
107 } 107 }
108 } 108 }
109 mnt->mnt.mnt_master = &master->mnt; 109 mnt->mnt_master = &master->mnt;
110 CLEAR_MNT_SHARED(&mnt->mnt); 110 CLEAR_MNT_SHARED(&mnt->mnt);
111 return 0; 111 return 0;
112} 112}
@@ -123,7 +123,7 @@ void change_mnt_propagation(struct mount *mnt, int type)
123 do_make_slave(mnt); 123 do_make_slave(mnt);
124 if (type != MS_SLAVE) { 124 if (type != MS_SLAVE) {
125 list_del_init(&mnt->mnt.mnt_slave); 125 list_del_init(&mnt->mnt.mnt_slave);
126 mnt->mnt.mnt_master = NULL; 126 mnt->mnt_master = NULL;
127 if (type == MS_UNBINDABLE) 127 if (type == MS_UNBINDABLE)
128 mnt->mnt.mnt_flags |= MNT_UNBINDABLE; 128 mnt->mnt.mnt_flags |= MNT_UNBINDABLE;
129 else 129 else
@@ -149,9 +149,9 @@ static struct mount *propagation_next(struct mount *m,
149 return first_slave(m); 149 return first_slave(m);
150 150
151 while (1) { 151 while (1) {
152 struct mount *master = real_mount(m->mnt.mnt_master); 152 struct mount *master = real_mount(m->mnt_master);
153 153
154 if (&master->mnt == origin->mnt.mnt_master) { 154 if (&master->mnt == origin->mnt_master) {
155 struct mount *next = next_peer(m); 155 struct mount *next = next_peer(m);
156 return (next == origin) ? NULL : next; 156 return (next == origin) ? NULL : next;
157 } else if (m->mnt.mnt_slave.next != &master->mnt.mnt_slave_list) 157 } else if (m->mnt.mnt_slave.next != &master->mnt.mnt_slave_list)
@@ -179,11 +179,11 @@ static struct mount *get_source(struct mount *dest,
179 struct mount *p_last_src = NULL; 179 struct mount *p_last_src = NULL;
180 struct mount *p_last_dest = NULL; 180 struct mount *p_last_dest = NULL;
181 181
182 while (&last_dest->mnt != dest->mnt.mnt_master) { 182 while (&last_dest->mnt != dest->mnt_master) {
183 p_last_dest = last_dest; 183 p_last_dest = last_dest;
184 p_last_src = last_src; 184 p_last_src = last_src;
185 last_dest = real_mount(last_dest->mnt.mnt_master); 185 last_dest = real_mount(last_dest->mnt_master);
186 last_src = real_mount(last_src->mnt.mnt_master); 186 last_src = real_mount(last_src->mnt_master);
187 } 187 }
188 188
189 if (p_last_dest) { 189 if (p_last_dest) {
diff --git a/include/linux/mount.h b/include/linux/mount.h
index e9990254d4d0..2d5beb5e3a8c 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -62,7 +62,6 @@ struct vfsmount {
62 struct list_head mnt_share; /* circular list of shared mounts */ 62 struct list_head mnt_share; /* circular list of shared mounts */
63 struct list_head mnt_slave_list;/* list of slave mounts */ 63 struct list_head mnt_slave_list;/* list of slave mounts */
64 struct list_head mnt_slave; /* slave list entry */ 64 struct list_head mnt_slave; /* slave list entry */
65 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
66 struct mnt_namespace *mnt_ns; /* containing namespace */ 65 struct mnt_namespace *mnt_ns; /* containing namespace */
67 int mnt_id; /* mount identifier */ 66 int mnt_id; /* mount identifier */
68 int mnt_group_id; /* peer group identifier */ 67 int mnt_group_id; /* peer group identifier */