btrfs, nfs, apparmor: don't pull mnt_namespace.h for no reason...
[firefly-linux-kernel-4.4.55.git] / fs / dcache.c
index 89509b5a090e27320e45b9c0c2f5480e082b1a37..64c8ce4c147fa9409df528312af5097fd0014c79 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/prefetch.h>
 #include <linux/ratelimit.h>
 #include "internal.h"
+#include "mount.h"
 
 /*
  * Usage:
@@ -2460,9 +2461,8 @@ static int prepend_path(const struct path *path,
 
                if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
                        /* Global root? */
-                       if (vfsmnt->mnt_parent == vfsmnt) {
+                       if (!mnt_has_parent(vfsmnt))
                                goto global_root;
-                       }
                        dentry = vfsmnt->mnt_mountpoint;
                        vfsmnt = vfsmnt->mnt_parent;
                        continue;
@@ -2853,31 +2853,6 @@ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
        return result;
 }
 
-int path_is_under(struct path *path1, struct path *path2)
-{
-       struct vfsmount *mnt = path1->mnt;
-       struct dentry *dentry = path1->dentry;
-       int res;
-
-       br_read_lock(vfsmount_lock);
-       if (mnt != path2->mnt) {
-               for (;;) {
-                       if (mnt->mnt_parent == mnt) {
-                               br_read_unlock(vfsmount_lock);
-                               return 0;
-                       }
-                       if (mnt->mnt_parent == path2->mnt)
-                               break;
-                       mnt = mnt->mnt_parent;
-               }
-               dentry = mnt->mnt_mountpoint;
-       }
-       res = is_subdir(dentry, path2->dentry);
-       br_read_unlock(vfsmount_lock);
-       return res;
-}
-EXPORT_SYMBOL(path_is_under);
-
 void d_genocide(struct dentry *root)
 {
        struct dentry *this_parent;