diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-11-23 19:26:23 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-03 22:52:36 -0500 |
commit | b2dba1af3c4157040303a76d25216b1713d333d0 (patch) | |
tree | c846b1c8074d29b9fc02ef3eeda98631dfd6ee94 /fs/dcache.c | |
parent | aa9c0e07bb90589186f3b5a0ca97660c2cb50806 (diff) |
vfs: new internal helper: mnt_has_parent(mnt)
vfsmounts have ->mnt_parent pointing either to a different vfsmount
or to itself; it's never NULL and termination condition in loops
traversing the tree towards root is mnt == mnt->mnt_parent. At least
one place (see the next patch) is confused about what's going on;
let's add an explicit helper checking it right way and use it in
all places where we need it. Not that there had been too many,
but...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 89509b5a090e..8a75e3b0f49d 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: |
@@ -2460,9 +2461,8 @@ static int prepend_path(const struct path *path, | |||
2460 | 2461 | ||
2461 | if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { | 2462 | if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { |
2462 | /* Global root? */ | 2463 | /* Global root? */ |
2463 | if (vfsmnt->mnt_parent == vfsmnt) { | 2464 | if (!mnt_has_parent(vfsmnt)) |
2464 | goto global_root; | 2465 | goto global_root; |
2465 | } | ||
2466 | dentry = vfsmnt->mnt_mountpoint; | 2466 | dentry = vfsmnt->mnt_mountpoint; |
2467 | vfsmnt = vfsmnt->mnt_parent; | 2467 | vfsmnt = vfsmnt->mnt_parent; |
2468 | continue; | 2468 | continue; |
@@ -2862,7 +2862,7 @@ int path_is_under(struct path *path1, struct path *path2) | |||
2862 | br_read_lock(vfsmount_lock); | 2862 | br_read_lock(vfsmount_lock); |
2863 | if (mnt != path2->mnt) { | 2863 | if (mnt != path2->mnt) { |
2864 | for (;;) { | 2864 | for (;;) { |
2865 | if (mnt->mnt_parent == mnt) { | 2865 | if (!mnt_has_parent(mnt)) { |
2866 | br_read_unlock(vfsmount_lock); | 2866 | br_read_unlock(vfsmount_lock); |
2867 | return 0; | 2867 | return 0; |
2868 | } | 2868 | } |