diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-11-24 22:00:28 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-03 22:57:04 -0500 |
commit | 643822b41e5e0f133438883b0be574cdaf168a2a (patch) | |
tree | 1b9bbeace5c1078ae6e893e2f826b724411d3a07 /fs/namespace.c | |
parent | 676da58df740f325034b8641311413c2393588e1 (diff) | |
download | lwn-643822b41e5e0f133438883b0be574cdaf168a2a.tar.gz lwn-643822b41e5e0f133438883b0be574cdaf168a2a.zip |
vfs: spread struct mount - is_path_reachable
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 14 |
1 files changed, 7 insertions, 7 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: * * namespace_sem or vfsmount_lock is held */ -bool is_path_reachable(struct vfsmount *mnt, struct dentry *dentry, +bool is_path_reachable(struct mount *mnt, struct dentry *dentry, const struct path *root) { - while (mnt != root->mnt && mnt_has_parent(real_mount(mnt))) { - dentry = mnt->mnt_mountpoint; - mnt = mnt->mnt_parent; + while (&mnt->mnt != root->mnt && mnt_has_parent(mnt)) { + dentry = mnt->mnt.mnt_mountpoint; + mnt = real_mount(mnt->mnt.mnt_parent); } - return mnt == root->mnt && is_subdir(dentry, root->dentry); + return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry); } int path_is_under(struct path *path1, struct path *path2) { int res; br_read_lock(vfsmount_lock); - res = is_path_reachable(path1->mnt, path1->dentry, path2); + res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2); br_read_unlock(vfsmount_lock); return res; } @@ -2659,7 +2659,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, if (!mnt_has_parent(new_mnt)) goto out4; /* not attached */ /* make sure we can reach put_old from new_root */ - if (!is_path_reachable(old.mnt, old.dentry, &new)) + if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new)) goto out4; br_write_lock(vfsmount_lock); detach_mnt(new_mnt, &parent_path); |