linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] VFS: d_obtain_alias needs to use "/" as default name.
@ 2012-08-09  1:57 NeilBrown
  0 siblings, 0 replies; only message in thread
From: NeilBrown @ 2012-08-09  1:57 UTC (permalink / raw)
  To: Al Viro, Myklebust, Trond; +Cc: NFS, lkml

[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]


NFS appears to use d_obtain_alias() to create the root dentry rather
than d_make_root.  This can cause 'prepend_path()' to complain that the
root has a weird name if an NFS filesystem is lazily unmounted.
e.g. if "/mnt" is an NFS mount then

 { cd /mnt; umount -l /mnt ; ls -l /proc/self/cwd; }

will cause a WARN message like
   WARNING: at /home/git/linux/fs/dcache.c:2624 prepend_path+0x1d7/0x1e0()
   ...
   Root dentry has weird name <>

to appear in kernel logs.

So change d_obtain_alias() to use "/" rather than "" as the anonymous
name.

Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/fs/dcache.c b/fs/dcache.c
index 8086636..c959e41 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1579,7 +1579,7 @@ EXPORT_SYMBOL(d_find_any_alias);
  */
 struct dentry *d_obtain_alias(struct inode *inode)
 {
-	static const struct qstr anonstring = { .name = "" };
+	static const struct qstr anonstring = QSTR_INIT("/", 1);
 	struct dentry *tmp;
 	struct dentry *res;
 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-09  1:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-09  1:57 [PATCH] VFS: d_obtain_alias needs to use "/" as default name NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).