aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-24 19:54:23 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:56:59 -0500
commit4b8b21f4fe16ee15eec5c69ea5fb41b30e428e59 (patch)
tree9e023742369b09578f6510cf6cce36d7529b6854 /fs/namespace.c
parent4b2619a571f9fbb46649f968eea284103734f718 (diff)
vfs: spread struct mount - mount group id handling
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index fad3b218679..60d5c15c087 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -110,7 +110,7 @@ static void mnt_free_id(struct vfsmount *mnt)
110 * 110 *
111 * mnt_group_ida is protected by namespace_sem 111 * mnt_group_ida is protected by namespace_sem
112 */ 112 */
113static int mnt_alloc_group_id(struct vfsmount *mnt) 113static int mnt_alloc_group_id(struct mount *mnt)
114{ 114{
115 int res; 115 int res;
116 116
@@ -119,9 +119,9 @@ static int mnt_alloc_group_id(struct vfsmount *mnt)
119 119
120 res = ida_get_new_above(&mnt_group_ida, 120 res = ida_get_new_above(&mnt_group_ida,
121 mnt_group_start, 121 mnt_group_start,
122 &mnt->mnt_group_id); 122 &mnt->mnt.mnt_group_id);
123 if (!res) 123 if (!res)
124 mnt_group_start = mnt->mnt_group_id + 1; 124 mnt_group_start = mnt->mnt.mnt_group_id + 1;
125 125
126 return res; 126 return res;
127} 127}
@@ -129,13 +129,13 @@ static int mnt_alloc_group_id(struct vfsmount *mnt)
129/* 129/*
130 * Release a peer group ID 130 * Release a peer group ID
131 */ 131 */
132void mnt_release_group_id(struct vfsmount *mnt) 132void mnt_release_group_id(struct mount *mnt)
133{ 133{
134 int id = mnt->mnt_group_id; 134 int id = mnt->mnt.mnt_group_id;
135 ida_remove(&mnt_group_ida, id); 135 ida_remove(&mnt_group_ida, id);
136 if (mnt_group_start > id) 136 if (mnt_group_start > id)
137 mnt_group_start = id; 137 mnt_group_start = id;
138 mnt->mnt_group_id = 0; 138 mnt->mnt.mnt_group_id = 0;
139} 139}
140 140
141/* 141/*
@@ -701,7 +701,7 @@ static struct vfsmount *clone_mnt(struct vfsmount *old, struct dentry *root,
701 mnt->mnt_group_id = old->mnt_group_id; 701 mnt->mnt_group_id = old->mnt_group_id;
702 702
703 if ((flag & CL_MAKE_SHARED) && !mnt->mnt_group_id) { 703 if ((flag & CL_MAKE_SHARED) && !mnt->mnt_group_id) {
704 int err = mnt_alloc_group_id(mnt); 704 int err = mnt_alloc_group_id(real_mount(mnt));
705 if (err) 705 if (err)
706 goto out_free; 706 goto out_free;
707 } 707 }
@@ -1497,25 +1497,25 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
1497 return 0; 1497 return 0;
1498} 1498}
1499 1499
1500static void cleanup_group_ids(struct vfsmount *mnt, struct vfsmount *end) 1500static void cleanup_group_ids(struct mount *mnt, struct mount *end)
1501{ 1501{
1502 struct mount *p; 1502 struct mount *p;
1503 1503
1504 for (p = real_mount(mnt); &p->mnt != end; p = next_mnt(p, mnt)) { 1504 for (p = mnt; p != end; p = next_mnt(p, &mnt->mnt)) {
1505 if (p->mnt.mnt_group_id && !IS_MNT_SHARED(&p->mnt)) 1505 if (p->mnt.mnt_group_id && !IS_MNT_SHARED(&p->mnt))
1506 mnt_release_group_id(&p->mnt); 1506 mnt_release_group_id(p);
1507 } 1507 }
1508} 1508}
1509 1509
1510static int invent_group_ids(struct vfsmount *mnt, bool recurse) 1510static int invent_group_ids(struct mount *mnt, bool recurse)
1511{ 1511{
1512 struct mount *p; 1512 struct mount *p;
1513 1513
1514 for (p = real_mount(mnt); p; p = recurse ? next_mnt(p, mnt) : NULL) { 1514 for (p = mnt; p; p = recurse ? next_mnt(p, &mnt->mnt) : NULL) {
1515 if (!p->mnt.mnt_group_id && !IS_MNT_SHARED(&p->mnt)) { 1515 if (!p->mnt.mnt_group_id && !IS_MNT_SHARED(&p->mnt)) {
1516 int err = mnt_alloc_group_id(&p->mnt); 1516 int err = mnt_alloc_group_id(p);
1517 if (err) { 1517 if (err) {
1518 cleanup_group_ids(mnt, &p->mnt); 1518 cleanup_group_ids(mnt, p);
1519 return err; 1519 return err;
1520 } 1520 }
1521 } 1521 }
@@ -1597,7 +1597,7 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
1597 int err; 1597 int err;
1598 1598
1599 if (IS_MNT_SHARED(dest_mnt)) { 1599 if (IS_MNT_SHARED(dest_mnt)) {
1600 err = invent_group_ids(source_mnt, true); 1600 err = invent_group_ids(real_mount(source_mnt), true);
1601 if (err) 1601 if (err)
1602 goto out; 1602 goto out;
1603 } 1603 }
@@ -1630,7 +1630,7 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
1630 1630
1631 out_cleanup_ids: 1631 out_cleanup_ids:
1632 if (IS_MNT_SHARED(dest_mnt)) 1632 if (IS_MNT_SHARED(dest_mnt))
1633 cleanup_group_ids(source_mnt, NULL); 1633 cleanup_group_ids(real_mount(source_mnt), NULL);
1634 out: 1634 out:
1635 return err; 1635 return err;
1636} 1636}
@@ -1700,7 +1700,7 @@ static int flags_to_propagation_type(int flags)
1700static int do_change_type(struct path *path, int flag) 1700static int do_change_type(struct path *path, int flag)
1701{ 1701{
1702 struct mount *m; 1702 struct mount *m;
1703 struct vfsmount *mnt = path->mnt; 1703 struct mount *mnt = real_mount(path->mnt);
1704 int recurse = flag & MS_REC; 1704 int recurse = flag & MS_REC;
1705 int type; 1705 int type;
1706 int err = 0; 1706 int err = 0;
@@ -1723,7 +1723,7 @@ static int do_change_type(struct path *path, int flag)
1723 } 1723 }
1724 1724
1725 br_write_lock(vfsmount_lock); 1725 br_write_lock(vfsmount_lock);
1726 for (m = real_mount(mnt); m; m = (recurse ? next_mnt(m, mnt) : NULL)) 1726 for (m = mnt; m; m = (recurse ? next_mnt(m, &mnt->mnt) : NULL))
1727 change_mnt_propagation(&m->mnt, type); 1727 change_mnt_propagation(&m->mnt, type);
1728 br_write_unlock(vfsmount_lock); 1728 br_write_unlock(vfsmount_lock);
1729 1729