Merge remote-tracking branch 'lsk/v3.10/topic/juno' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / fs / dcache.c
index da89cdfb21ab8ab90905b8fc811cf62abd355678..9a59653d3449753923e3ddfd97e9d9eca2f36f04 100644 (file)
@@ -2686,8 +2686,13 @@ char *d_path(const struct path *path, char *buf, int buflen)
         * thus don't need to be hashed.  They also don't need a name until a
         * user wants to identify the object in /proc/pid/fd/.  The little hack
         * below allows us to generate a name for these objects on demand:
+        *
+        * Some pseudo inodes are mountable.  When they are mounted
+        * path->dentry == path->mnt->mnt_root.  In that case don't call d_dname
+        * and instead have d_path return the mounted path.
         */
-       if (path->dentry->d_op && path->dentry->d_op->d_dname)
+       if (path->dentry->d_op && path->dentry->d_op->d_dname &&
+           (!IS_ROOT(path->dentry) || path->dentry != path->mnt->mnt_root))
                return path->dentry->d_op->d_dname(path->dentry, buf, buflen);
 
        get_fs_root(current->fs, &root);