summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-25 09:50:41 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-04 07:57:10 +0400
commit15169fe784a9846b24cdb0840329d41aebc23249 (patch)
treeef9e843dcd333204fd7fdca6d21fe96d0647da80
parent143c8c91cee7efdd732ec5f61b3471fc46192f20 (diff)
downloadlinux-15169fe784a9846b24cdb0840329d41aebc23249.tar.xz
vfs: mnt_id/mnt_group_id moved
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/fhandle.c4
-rw-r--r--fs/mount.h2
-rw-r--r--fs/namespace.c30
-rw-r--r--fs/pnode.c4
-rw-r--r--include/linux/mount.h2
5 files changed, 22 insertions, 20 deletions
diff --git a/fs/fhandle.c b/fs/fhandle.c
index 6b088641f5bf..5eff7116951e 100644
--- a/fs/fhandle.c
+++ b/fs/fhandle.c
@@ -10,6 +10,7 @@
#include <linux/personality.h>
#include <asm/uaccess.h>
#include "internal.h"
+#include "mount.h"
static long do_sys_name_to_handle(struct path *path,
struct file_handle __user *ufh,
@@ -66,7 +67,8 @@ static long do_sys_name_to_handle(struct path *path,
} else
retval = 0;
/* copy the mount id */
- if (copy_to_user(mnt_id, &path->mnt->mnt_id, sizeof(*mnt_id)) ||
+ if (copy_to_user(mnt_id, &real_mount(path->mnt)->mnt_id,
+ sizeof(*mnt_id)) ||
copy_to_user(ufh, handle,
sizeof(struct file_handle) + handle_bytes))
retval = -EFAULT;
diff --git a/fs/mount.h b/fs/mount.h
index 4a5f1dca0c2e..c7bd401960ea 100644
--- a/fs/mount.h
+++ b/fs/mount.h
@@ -26,6 +26,8 @@ struct mount {
struct list_head mnt_slave; /* slave list entry */
struct mount *mnt_master; /* slave is on master->mnt_slave_list */
struct mnt_namespace *mnt_ns; /* containing namespace */
+ int mnt_id; /* mount identifier */
+ int mnt_group_id; /* peer group identifier */
};
static inline struct mount *real_mount(struct vfsmount *mnt)
diff --git a/fs/namespace.c b/fs/namespace.c
index 4cdb7f698613..dfed9a25f204 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -85,9 +85,9 @@ static int mnt_alloc_id(struct mount *mnt)
retry:
ida_pre_get(&mnt_id_ida, GFP_KERNEL);
spin_lock(&mnt_id_lock);
- res = ida_get_new_above(&mnt_id_ida, mnt_id_start, &mnt->mnt.mnt_id);
+ res = ida_get_new_above(&mnt_id_ida, mnt_id_start, &mnt->mnt_id);
if (!res)
- mnt_id_start = mnt->mnt.mnt_id + 1;
+ mnt_id_start = mnt->mnt_id + 1;
spin_unlock(&mnt_id_lock);
if (res == -EAGAIN)
goto retry;
@@ -97,7 +97,7 @@ retry:
static void mnt_free_id(struct mount *mnt)
{
- int id = mnt->mnt.mnt_id;
+ int id = mnt->mnt_id;
spin_lock(&mnt_id_lock);
ida_remove(&mnt_id_ida, id);
if (mnt_id_start > id)
@@ -119,9 +119,9 @@ static int mnt_alloc_group_id(struct mount *mnt)
res = ida_get_new_above(&mnt_group_ida,
mnt_group_start,
- &mnt->mnt.mnt_group_id);
+ &mnt->mnt_group_id);
if (!res)
- mnt_group_start = mnt->mnt.mnt_group_id + 1;
+ mnt_group_start = mnt->mnt_group_id + 1;
return res;
}
@@ -131,11 +131,11 @@ static int mnt_alloc_group_id(struct mount *mnt)
*/
void mnt_release_group_id(struct mount *mnt)
{
- int id = mnt->mnt.mnt_group_id;
+ int id = mnt->mnt_group_id;
ida_remove(&mnt_group_ida, id);
if (mnt_group_start > id)
mnt_group_start = id;
- mnt->mnt.mnt_group_id = 0;
+ mnt->mnt_group_id = 0;
}
/*
@@ -696,11 +696,11 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
if (mnt) {
if (flag & (CL_SLAVE | CL_PRIVATE))
- mnt->mnt.mnt_group_id = 0; /* not a peer of original */
+ mnt->mnt_group_id = 0; /* not a peer of original */
else
- mnt->mnt.mnt_group_id = old->mnt.mnt_group_id;
+ mnt->mnt_group_id = old->mnt_group_id;
- if ((flag & CL_MAKE_SHARED) && !mnt->mnt.mnt_group_id) {
+ if ((flag & CL_MAKE_SHARED) && !mnt->mnt_group_id) {
int err = mnt_alloc_group_id(mnt);
if (err)
goto out_free;
@@ -1029,7 +1029,7 @@ static int show_mountinfo(struct seq_file *m, void *v)
struct path root = p->root;
int err = 0;
- seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, r->mnt_parent->mnt.mnt_id,
+ seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
MAJOR(sb->s_dev), MINOR(sb->s_dev));
if (sb->s_op->show_path)
err = sb->s_op->show_path(m, mnt);
@@ -1049,9 +1049,9 @@ static int show_mountinfo(struct seq_file *m, void *v)
/* Tagged fields ("foo:X" or "bar") */
if (IS_MNT_SHARED(mnt))
- seq_printf(m, " shared:%i", mnt->mnt_group_id);
+ seq_printf(m, " shared:%i", r->mnt_group_id);
if (IS_MNT_SLAVE(r)) {
- int master = r->mnt_master->mnt.mnt_group_id;
+ int master = r->mnt_master->mnt_group_id;
int dom = get_dominating_id(r, &p->root);
seq_printf(m, " master:%i", master);
if (dom && dom != master)
@@ -1507,7 +1507,7 @@ static void cleanup_group_ids(struct mount *mnt, struct mount *end)
struct mount *p;
for (p = mnt; p != end; p = next_mnt(p, &mnt->mnt)) {
- if (p->mnt.mnt_group_id && !IS_MNT_SHARED(&p->mnt))
+ if (p->mnt_group_id && !IS_MNT_SHARED(&p->mnt))
mnt_release_group_id(p);
}
}
@@ -1517,7 +1517,7 @@ static int invent_group_ids(struct mount *mnt, bool recurse)
struct mount *p;
for (p = mnt; p; p = recurse ? next_mnt(p, &mnt->mnt) : NULL) {
- if (!p->mnt.mnt_group_id && !IS_MNT_SHARED(&p->mnt)) {
+ if (!p->mnt_group_id && !IS_MNT_SHARED(&p->mnt)) {
int err = mnt_alloc_group_id(p);
if (err) {
cleanup_group_ids(mnt, p);
diff --git a/fs/pnode.c b/fs/pnode.c
index cec329822a16..001c8b0df379 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -58,7 +58,7 @@ int get_dominating_id(struct mount *mnt, const struct path *root)
for (m = mnt->mnt_master; m != NULL; m = m->mnt_master) {
struct mount *d = get_peer_under_root(m, mnt->mnt_ns, root);
if (d)
- return d->mnt.mnt_group_id;
+ return d->mnt_group_id;
}
return 0;
@@ -86,7 +86,7 @@ static int do_make_slave(struct mount *mnt)
mnt_release_group_id(mnt);
list_del_init(&mnt->mnt_share);
- mnt->mnt.mnt_group_id = 0;
+ mnt->mnt_group_id = 0;
if (peer_mnt)
master = peer_mnt;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index eb8c1f1be90c..b26dc40bfafc 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -58,8 +58,6 @@ struct vfsmount {
#endif
const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
struct list_head mnt_list;
- int mnt_id; /* mount identifier */
- int mnt_group_id; /* peer group identifier */
int mnt_expiry_mark; /* true if marked for expiry */
int mnt_pinned;
int mnt_ghosts;