aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/dcache.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 4365998b8df4..74da947b160b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2191,6 +2191,30 @@ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
2191 return result; 2191 return result;
2192} 2192}
2193 2193
2194int path_is_under(struct path *path1, struct path *path2)
2195{
2196 struct vfsmount *mnt = path1->mnt;
2197 struct dentry *dentry = path1->dentry;
2198 int res;
2199 spin_lock(&vfsmount_lock);
2200 if (mnt != path2->mnt) {
2201 for (;;) {
2202 if (mnt->mnt_parent == mnt) {
2203 spin_unlock(&vfsmount_lock);
2204 return 0;
2205 }
2206 if (mnt->mnt_parent == path2->mnt)
2207 break;
2208 mnt = mnt->mnt_parent;
2209 }
2210 dentry = mnt->mnt_mountpoint;
2211 }
2212 res = is_subdir(dentry, path2->dentry);
2213 spin_unlock(&vfsmount_lock);
2214 return res;
2215}
2216EXPORT_SYMBOL(path_is_under);
2217
2194void d_genocide(struct dentry *root) 2218void d_genocide(struct dentry *root)
2195{ 2219{
2196 struct dentry *this_parent = root; 2220 struct dentry *this_parent = root;