aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pnode.c')
-rw-r--r--fs/pnode.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/fs/pnode.c b/fs/pnode.c
index 8cd90d2ec05e..29e366dec024 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -28,19 +28,19 @@ static inline struct vfsmount *next_slave(struct vfsmount *p)
28 return list_entry(p->mnt_slave.next, struct vfsmount, mnt_slave); 28 return list_entry(p->mnt_slave.next, struct vfsmount, mnt_slave);
29} 29}
30 30
31static struct vfsmount *get_peer_under_root(struct vfsmount *mnt, 31static struct mount *get_peer_under_root(struct mount *mnt,
32 struct mnt_namespace *ns, 32 struct mnt_namespace *ns,
33 const struct path *root) 33 const struct path *root)
34{ 34{
35 struct mount *m = real_mount(mnt); 35 struct mount *m = mnt;
36 36
37 do { 37 do {
38 /* Check the namespace first for optimization */ 38 /* Check the namespace first for optimization */
39 if (m->mnt.mnt_ns == ns && is_path_reachable(m, m->mnt.mnt_root, root)) 39 if (m->mnt.mnt_ns == ns && is_path_reachable(m, m->mnt.mnt_root, root))
40 return &m->mnt; 40 return m;
41 41
42 m = real_mount(next_peer(&m->mnt)); 42 m = real_mount(next_peer(&m->mnt));
43 } while (&m->mnt != mnt); 43 } while (m != mnt);
44 44
45 return NULL; 45 return NULL;
46} 46}
@@ -51,22 +51,22 @@ static struct vfsmount *get_peer_under_root(struct vfsmount *mnt,
51 * 51 *
52 * Caller must hold namespace_sem 52 * Caller must hold namespace_sem
53 */ 53 */
54int get_dominating_id(struct vfsmount *mnt, const struct path *root) 54int get_dominating_id(struct mount *mnt, const struct path *root)
55{ 55{
56 struct vfsmount *m; 56 struct mount *m;
57 57
58 for (m = mnt->mnt_master; m != NULL; m = m->mnt_master) { 58 for (m = real_mount(mnt->mnt.mnt_master); m != NULL; m = real_mount(m->mnt.mnt_master)) {
59 struct vfsmount *d = get_peer_under_root(m, 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_group_id; 61 return d->mnt.mnt_group_id;
62 } 62 }
63 63
64 return 0; 64 return 0;
65} 65}
66 66
67static int do_make_slave(struct vfsmount *mnt) 67static int do_make_slave(struct mount *mnt)
68{ 68{
69 struct vfsmount *peer_mnt = mnt, *master = mnt->mnt_master; 69 struct mount *peer_mnt = mnt, *master = real_mount(mnt->mnt.mnt_master);
70 struct vfsmount *slave_mnt; 70 struct vfsmount *slave_mnt;
71 71
72 /* 72 /*
@@ -74,31 +74,31 @@ static int do_make_slave(struct vfsmount *mnt)
74 * same root dentry. If none is available then 74 * same root dentry. If none is available then
75 * slave it to anything that is available. 75 * slave it to anything that is available.
76 */ 76 */
77 while ((peer_mnt = next_peer(peer_mnt)) != mnt && 77 while ((peer_mnt = real_mount(next_peer(&peer_mnt->mnt))) != mnt &&
78 peer_mnt->mnt_root != mnt->mnt_root) ; 78 peer_mnt->mnt.mnt_root != mnt->mnt.mnt_root) ;
79 79
80 if (peer_mnt == mnt) { 80 if (peer_mnt == mnt) {
81 peer_mnt = next_peer(mnt); 81 peer_mnt = real_mount(next_peer(&mnt->mnt));
82 if (peer_mnt == mnt) 82 if (peer_mnt == mnt)
83 peer_mnt = NULL; 83 peer_mnt = NULL;
84 } 84 }
85 if (IS_MNT_SHARED(mnt) && list_empty(&mnt->mnt_share)) 85 if (IS_MNT_SHARED(&mnt->mnt) && list_empty(&mnt->mnt.mnt_share))
86 mnt_release_group_id(real_mount(mnt)); 86 mnt_release_group_id(mnt);
87 87
88 list_del_init(&mnt->mnt_share); 88 list_del_init(&mnt->mnt.mnt_share);
89 mnt->mnt_group_id = 0; 89 mnt->mnt.mnt_group_id = 0;
90 90
91 if (peer_mnt) 91 if (peer_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_slave_list, mnt_slave) 95 list_for_each_entry(slave_mnt, &mnt->mnt.mnt_slave_list, mnt_slave)
96 slave_mnt->mnt_master = master; 96 slave_mnt->mnt_master = &master->mnt;
97 list_move(&mnt->mnt_slave, &master->mnt_slave_list); 97 list_move(&mnt->mnt.mnt_slave, &master->mnt.mnt_slave_list);
98 list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev); 98 list_splice(&mnt->mnt.mnt_slave_list, master->mnt.mnt_slave_list.prev);
99 INIT_LIST_HEAD(&mnt->mnt_slave_list); 99 INIT_LIST_HEAD(&mnt->mnt.mnt_slave_list);
100 } else { 100 } else {
101 struct list_head *p = &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 vfsmount, mnt_slave);
@@ -106,8 +106,8 @@ static int do_make_slave(struct vfsmount *mnt)
106 slave_mnt->mnt_master = NULL; 106 slave_mnt->mnt_master = NULL;
107 } 107 }
108 } 108 }
109 mnt->mnt_master = master; 109 mnt->mnt.mnt_master = &master->mnt;
110 CLEAR_MNT_SHARED(mnt); 110 CLEAR_MNT_SHARED(&mnt->mnt);
111 return 0; 111 return 0;
112} 112}
113 113
@@ -120,7 +120,7 @@ void change_mnt_propagation(struct mount *mnt, int type)
120 set_mnt_shared(mnt); 120 set_mnt_shared(mnt);
121 return; 121 return;
122 } 122 }
123 do_make_slave(&mnt->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.mnt_master = NULL;