aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-25 00:22:05 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:57:08 -0500
commit6776db3d32b2a59198ec7ac6d32be0b9fdbd8a68 (patch)
treed293d993f41bdea79eaeb51f404e9837a49cb039 /fs/namespace.c
parent32301920f44a9334f57dd94bebfc6e593b99ad47 (diff)
vfs: take mnt_share/mnt_slave/mnt_slave_list and mnt_expire to struct mount
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 847b7240c512..a14750be7a70 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -203,10 +203,10 @@ static struct mount *alloc_vfsmnt(const char *name)
203 INIT_LIST_HEAD(&p->mnt_child); 203 INIT_LIST_HEAD(&p->mnt_child);
204 INIT_LIST_HEAD(&p->mnt_mounts); 204 INIT_LIST_HEAD(&p->mnt_mounts);
205 INIT_LIST_HEAD(&mnt->mnt_list); 205 INIT_LIST_HEAD(&mnt->mnt_list);
206 INIT_LIST_HEAD(&mnt->mnt_expire); 206 INIT_LIST_HEAD(&p->mnt_expire);
207 INIT_LIST_HEAD(&mnt->mnt_share); 207 INIT_LIST_HEAD(&p->mnt_share);
208 INIT_LIST_HEAD(&mnt->mnt_slave_list); 208 INIT_LIST_HEAD(&p->mnt_slave_list);
209 INIT_LIST_HEAD(&mnt->mnt_slave); 209 INIT_LIST_HEAD(&p->mnt_slave);
210#ifdef CONFIG_FSNOTIFY 210#ifdef CONFIG_FSNOTIFY
211 INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks); 211 INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks);
212#endif 212#endif
@@ -714,14 +714,14 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
714 mnt->mnt_parent = mnt; 714 mnt->mnt_parent = mnt;
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_slave, &old->mnt_slave_list);
718 mnt->mnt_master = old; 718 mnt->mnt_master = old;
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_share, &old->mnt_share);
723 if (IS_MNT_SLAVE(old)) 723 if (IS_MNT_SLAVE(old))
724 list_add(&mnt->mnt.mnt_slave, &old->mnt.mnt_slave); 724 list_add(&mnt->mnt_slave, &old->mnt_slave);
725 mnt->mnt_master = old->mnt_master; 725 mnt->mnt_master = old->mnt_master;
726 } 726 }
727 if (flag & CL_MAKE_SHARED) 727 if (flag & CL_MAKE_SHARED)
@@ -730,8 +730,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
730 /* stick the duplicate mount on the same expiry list 730 /* stick the duplicate mount on the same expiry list
731 * as the original if that was on one */ 731 * as the original if that was on one */
732 if (flag & CL_EXPIRE) { 732 if (flag & CL_EXPIRE) {
733 if (!list_empty(&old->mnt.mnt_expire)) 733 if (!list_empty(&old->mnt_expire))
734 list_add(&mnt->mnt.mnt_expire, &old->mnt.mnt_expire); 734 list_add(&mnt->mnt_expire, &old->mnt_expire);
735 } 735 }
736 } 736 }
737 return mnt; 737 return mnt;
@@ -1233,7 +1233,7 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
1233 propagate_umount(&tmp_list); 1233 propagate_umount(&tmp_list);
1234 1234
1235 list_for_each_entry(p, &tmp_list, mnt_hash) { 1235 list_for_each_entry(p, &tmp_list, mnt_hash) {
1236 list_del_init(&p->mnt.mnt_expire); 1236 list_del_init(&p->mnt_expire);
1237 list_del_init(&p->mnt.mnt_list); 1237 list_del_init(&p->mnt.mnt_list);
1238 __touch_mnt_namespace(p->mnt.mnt_ns); 1238 __touch_mnt_namespace(p->mnt.mnt_ns);
1239 p->mnt.mnt_ns = NULL; 1239 p->mnt.mnt_ns = NULL;
@@ -1921,7 +1921,7 @@ static int do_move_mount(struct path *path, char *old_name)
1921 1921
1922 /* if the mount is moved, it should no longer be expire 1922 /* if the mount is moved, it should no longer be expire
1923 * automatically */ 1923 * automatically */
1924 list_del_init(&old_path.mnt->mnt_expire); 1924 list_del_init(&old->mnt_expire);
1925out1: 1925out1:
1926 unlock_mount(path); 1926 unlock_mount(path);
1927out: 1927out:
@@ -2033,11 +2033,12 @@ static int do_new_mount(struct path *path, char *type, int flags,
2033 2033
2034int finish_automount(struct vfsmount *m, struct path *path) 2034int finish_automount(struct vfsmount *m, struct path *path)
2035{ 2035{
2036 struct mount *mnt = real_mount(m);
2036 int err; 2037 int err;
2037 /* The new mount record should have at least 2 refs to prevent it being 2038 /* The new mount record should have at least 2 refs to prevent it being
2038 * expired before we get a chance to add it 2039 * expired before we get a chance to add it
2039 */ 2040 */
2040 BUG_ON(mnt_get_count(real_mount(m)) < 2); 2041 BUG_ON(mnt_get_count(mnt) < 2);
2041 2042
2042 if (m->mnt_sb == path->mnt->mnt_sb && 2043 if (m->mnt_sb == path->mnt->mnt_sb &&
2043 m->mnt_root == path->dentry) { 2044 m->mnt_root == path->dentry) {
@@ -2050,10 +2051,10 @@ int finish_automount(struct vfsmount *m, struct path *path)
2050 return 0; 2051 return 0;
2051fail: 2052fail:
2052 /* remove m from any expiration list it may be on */ 2053 /* remove m from any expiration list it may be on */
2053 if (!list_empty(&m->mnt_expire)) { 2054 if (!list_empty(&mnt->mnt_expire)) {
2054 down_write(&namespace_sem); 2055 down_write(&namespace_sem);
2055 br_write_lock(vfsmount_lock); 2056 br_write_lock(vfsmount_lock);
2056 list_del_init(&m->mnt_expire); 2057 list_del_init(&mnt->mnt_expire);
2057 br_write_unlock(vfsmount_lock); 2058 br_write_unlock(vfsmount_lock);
2058 up_write(&namespace_sem); 2059 up_write(&namespace_sem);
2059 } 2060 }
@@ -2072,7 +2073,7 @@ void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list)
2072 down_write(&namespace_sem); 2073 down_write(&namespace_sem);
2073 br_write_lock(vfsmount_lock); 2074 br_write_lock(vfsmount_lock);
2074 2075
2075 list_add_tail(&mnt->mnt_expire, expiry_list); 2076 list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list);
2076 2077
2077 br_write_unlock(vfsmount_lock); 2078 br_write_unlock(vfsmount_lock);
2078 up_write(&namespace_sem); 2079 up_write(&namespace_sem);
@@ -2102,14 +2103,14 @@ void mark_mounts_for_expiry(struct list_head *mounts)
2102 * - still marked for expiry (marked on the last call here; marks are 2103 * - still marked for expiry (marked on the last call here; marks are
2103 * cleared by mntput()) 2104 * cleared by mntput())
2104 */ 2105 */
2105 list_for_each_entry_safe(mnt, next, mounts, mnt.mnt_expire) { 2106 list_for_each_entry_safe(mnt, next, mounts, mnt_expire) {
2106 if (!xchg(&mnt->mnt.mnt_expiry_mark, 1) || 2107 if (!xchg(&mnt->mnt.mnt_expiry_mark, 1) ||
2107 propagate_mount_busy(mnt, 1)) 2108 propagate_mount_busy(mnt, 1))
2108 continue; 2109 continue;
2109 list_move(&mnt->mnt.mnt_expire, &graveyard); 2110 list_move(&mnt->mnt_expire, &graveyard);
2110 } 2111 }
2111 while (!list_empty(&graveyard)) { 2112 while (!list_empty(&graveyard)) {
2112 mnt = list_first_entry(&graveyard, struct mount, mnt.mnt_expire); 2113 mnt = list_first_entry(&graveyard, struct mount, mnt_expire);
2113 touch_mnt_namespace(mnt->mnt.mnt_ns); 2114 touch_mnt_namespace(mnt->mnt.mnt_ns);
2114 umount_tree(mnt, 1, &umounts); 2115 umount_tree(mnt, 1, &umounts);
2115 } 2116 }
@@ -2152,7 +2153,7 @@ resume:
2152 } 2153 }
2153 2154
2154 if (!propagate_mount_busy(mnt, 1)) { 2155 if (!propagate_mount_busy(mnt, 1)) {
2155 list_move_tail(&mnt->mnt.mnt_expire, graveyard); 2156 list_move_tail(&mnt->mnt_expire, graveyard);
2156 found++; 2157 found++;
2157 } 2158 }
2158 } 2159 }
@@ -2182,7 +2183,7 @@ static void shrink_submounts(struct mount *mnt, struct list_head *umounts)
2182 while (select_submounts(mnt, &graveyard)) { 2183 while (select_submounts(mnt, &graveyard)) {
2183 while (!list_empty(&graveyard)) { 2184 while (!list_empty(&graveyard)) {
2184 m = list_first_entry(&graveyard, struct mount, 2185 m = list_first_entry(&graveyard, struct mount,
2185 mnt.mnt_expire); 2186 mnt_expire);
2186 touch_mnt_namespace(m->mnt.mnt_ns); 2187 touch_mnt_namespace(m->mnt.mnt_ns);
2187 umount_tree(m, 1, umounts); 2188 umount_tree(m, 1, umounts);
2188 } 2189 }