diff options
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 89509b5a090e..9791b1e7eee4 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/prefetch.h> | 38 | #include <linux/prefetch.h> |
39 | #include <linux/ratelimit.h> | 39 | #include <linux/ratelimit.h> |
40 | #include "internal.h" | 40 | #include "internal.h" |
41 | #include "mount.h" | ||
41 | 42 | ||
42 | /* | 43 | /* |
43 | * Usage: | 44 | * Usage: |
@@ -2451,6 +2452,7 @@ static int prepend_path(const struct path *path, | |||
2451 | { | 2452 | { |
2452 | struct dentry *dentry = path->dentry; | 2453 | struct dentry *dentry = path->dentry; |
2453 | struct vfsmount *vfsmnt = path->mnt; | 2454 | struct vfsmount *vfsmnt = path->mnt; |
2455 | struct mount *mnt = real_mount(vfsmnt); | ||
2454 | bool slash = false; | 2456 | bool slash = false; |
2455 | int error = 0; | 2457 | int error = 0; |
2456 | 2458 | ||
@@ -2460,11 +2462,11 @@ static int prepend_path(const struct path *path, | |||
2460 | 2462 | ||
2461 | if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { | 2463 | if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { |
2462 | /* Global root? */ | 2464 | /* Global root? */ |
2463 | if (vfsmnt->mnt_parent == vfsmnt) { | 2465 | if (!mnt_has_parent(mnt)) |
2464 | goto global_root; | 2466 | goto global_root; |
2465 | } | 2467 | dentry = mnt->mnt_mountpoint; |
2466 | dentry = vfsmnt->mnt_mountpoint; | 2468 | mnt = mnt->mnt_parent; |
2467 | vfsmnt = vfsmnt->mnt_parent; | 2469 | vfsmnt = &mnt->mnt; |
2468 | continue; | 2470 | continue; |
2469 | } | 2471 | } |
2470 | parent = dentry->d_parent; | 2472 | parent = dentry->d_parent; |
@@ -2501,7 +2503,7 @@ global_root: | |||
2501 | if (!slash) | 2503 | if (!slash) |
2502 | error = prepend(buffer, buflen, "/", 1); | 2504 | error = prepend(buffer, buflen, "/", 1); |
2503 | if (!error) | 2505 | if (!error) |
2504 | error = vfsmnt->mnt_ns ? 1 : 2; | 2506 | error = real_mount(vfsmnt)->mnt_ns ? 1 : 2; |
2505 | goto out; | 2507 | goto out; |
2506 | } | 2508 | } |
2507 | 2509 | ||
@@ -2853,31 +2855,6 @@ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry) | |||
2853 | return result; | 2855 | return result; |
2854 | } | 2856 | } |
2855 | 2857 | ||
2856 | int path_is_under(struct path *path1, struct path *path2) | ||
2857 | { | ||
2858 | struct vfsmount *mnt = path1->mnt; | ||
2859 | struct dentry *dentry = path1->dentry; | ||
2860 | int res; | ||
2861 | |||
2862 | br_read_lock(vfsmount_lock); | ||
2863 | if (mnt != path2->mnt) { | ||
2864 | for (;;) { | ||
2865 | if (mnt->mnt_parent == mnt) { | ||
2866 | br_read_unlock(vfsmount_lock); | ||
2867 | return 0; | ||
2868 | } | ||
2869 | if (mnt->mnt_parent == path2->mnt) | ||
2870 | break; | ||
2871 | mnt = mnt->mnt_parent; | ||
2872 | } | ||
2873 | dentry = mnt->mnt_mountpoint; | ||
2874 | } | ||
2875 | res = is_subdir(dentry, path2->dentry); | ||
2876 | br_read_unlock(vfsmount_lock); | ||
2877 | return res; | ||
2878 | } | ||
2879 | EXPORT_SYMBOL(path_is_under); | ||
2880 | |||
2881 | void d_genocide(struct dentry *root) | 2858 | void d_genocide(struct dentry *root) |
2882 | { | 2859 | { |
2883 | struct dentry *this_parent; | 2860 | struct dentry *this_parent; |