]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vfs: d_obtain_alias() needs to use "/" as default name.
authorNeilBrown <neilb@suse.de>
Fri, 12 Oct 2012 04:22:46 +0000 (15:22 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 22 Oct 2012 04:01:02 +0000 (15:01 +1100)
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>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/dcache.c

index 3a463d0c4fe830d5c33c9dcf9ebd05e5caf5fb43..0d0adb661783f4eb1b74df65be5c2c03afdbae96 100644 (file)
@@ -1583,7 +1583,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;