diff --git a/fs/dcache.c b/fs/dcache.c index 995d08069d26d960de990beefadbc2323abaca73..f1809e6b9fdae2573aa4343c9c8652d19bcd8fcf 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1970,9 +1970,15 @@ char *__d_path(const struct path *path, struct path *root, return retval; global_root: - retval += 1; /* hit the slash */ - if (prepend_name(&retval, &buflen, &dentry->d_name) != 0) - goto Elong; + /* + * Filesystems needing to implement special "root names" + * should do so with ->d_dname() + */ + if (IS_ROOT(dentry) && + (dentry->d_name.len != 1 || dentry->d_name.name[0] != '/')) { + WARN(1, "Root dentry has weird name <%.*s>\n", + (int) dentry->d_name.len, dentry->d_name.name); + } root->mnt = vfsmnt; root->dentry = dentry; goto out;