aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-24 22:00:28 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:57:04 -0500
commit643822b41e5e0f133438883b0be574cdaf168a2a (patch)
tree1b9bbeace5c1078ae6e893e2f826b724411d3a07
parent676da58df740f325034b8641311413c2393588e1 (diff)
vfs: spread struct mount - is_path_reachable
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namespace.c14
-rw-r--r--fs/pnode.c10
-rw-r--r--fs/pnode.h2
3 files changed, 13 insertions, 13 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index ced3aa53fb38..b117d94fcdc1 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2559,21 +2559,21 @@ out_type:
2559 * 2559 *
2560 * namespace_sem or vfsmount_lock is held 2560 * namespace_sem or vfsmount_lock is held
2561 */ 2561 */
2562bool is_path_reachable(struct vfsmount *mnt, struct dentry *dentry, 2562bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
2563 const struct path *root) 2563 const struct path *root)
2564{ 2564{
2565 while (mnt != root->mnt && mnt_has_parent(real_mount(mnt))) { 2565 while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) {
2566 dentry = mnt->mnt_mountpoint; 2566 dentry = mnt->mnt.mnt_mountpoint;
2567 mnt = mnt->mnt_parent; 2567 mnt = real_mount(mnt->mnt.mnt_parent);
2568 } 2568 }
2569 return mnt == root->mnt && is_subdir(dentry, root->dentry); 2569 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
2570} 2570}
2571 2571
2572int path_is_under(struct path *path1, struct path *path2) 2572int path_is_under(struct path *path1, struct path *path2)
2573{ 2573{
2574 int res; 2574 int res;
2575 br_read_lock(vfsmount_lock); 2575 br_read_lock(vfsmount_lock);
2576 res = is_path_reachable(path1->mnt, path1->dentry, path2); 2576 res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
2577 br_read_unlock(vfsmount_lock); 2577 br_read_unlock(vfsmount_lock);
2578 return res; 2578 return res;
2579} 2579}
@@ -2659,7 +2659,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
2659 if (!mnt_has_parent(new_mnt)) 2659 if (!mnt_has_parent(new_mnt))
2660 goto out4; /* not attached */ 2660 goto out4; /* not attached */
2661 /* make sure we can reach put_old from new_root */ 2661 /* make sure we can reach put_old from new_root */
2662 if (!is_path_reachable(old.mnt, old.dentry, &new)) 2662 if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new))
2663 goto out4; 2663 goto out4;
2664 br_write_lock(vfsmount_lock); 2664 br_write_lock(vfsmount_lock);
2665 detach_mnt(new_mnt, &parent_path); 2665 detach_mnt(new_mnt, &parent_path);
diff --git a/fs/pnode.c b/fs/pnode.c
index 3105cca197ec..25f74b53dea6 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -32,15 +32,15 @@ static struct vfsmount *get_peer_under_root(struct vfsmount *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 vfsmount *m = mnt; 35 struct mount *m = real_mount(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_ns == ns && is_path_reachable(m, m->mnt_root, root)) 39 if (m->mnt.mnt_ns == ns && is_path_reachable(m, m->mnt.mnt_root, root))
40 return m; 40 return &m->mnt;
41 41
42 m = next_peer(m); 42 m = real_mount(next_peer(&m->mnt));
43 } while (m != mnt); 43 } while (&m->mnt != mnt);
44 44
45 return NULL; 45 return NULL;
46} 46}
diff --git a/fs/pnode.h b/fs/pnode.h
index f1d251d3771e..866b3e292887 100644
--- a/fs/pnode.h
+++ b/fs/pnode.h
@@ -42,6 +42,6 @@ void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
42void release_mounts(struct list_head *); 42void release_mounts(struct list_head *);
43void umount_tree(struct mount *, int, struct list_head *); 43void umount_tree(struct mount *, int, struct list_head *);
44struct mount *copy_tree(struct mount *, struct dentry *, int); 44struct mount *copy_tree(struct mount *, struct dentry *, int);
45bool is_path_reachable(struct vfsmount *, struct dentry *, 45bool is_path_reachable(struct mount *, struct dentry *,
46 const struct path *root); 46 const struct path *root);
47#endif /* _LINUX_PNODE_H */ 47#endif /* _LINUX_PNODE_H */