vfat dentry cache issues on 2.4.20

From: lkml
Date: Sat Aug 16 2003 - 19:18:27 EST


I'm still running 2.4.20 (for an nForce chipset) so changes between then
and the current kernel may have fixed this.

I was getting errors from ls sometimes. strace shows open() is failing
with "-1 ESTALE (Stale NFS file handle)" on the file ".". After adding
some printk()s to fs/namei.c and fs/vfat/namei.c I think the ESTALE is
coming from the return_err: in fs/namei.c .

In particular dentry->d_op->d_revalidate(dentry,0) is returning 1 causing
d_invalidate(dentry) to be called but this may not clear the cache because
the only way I've found to get rid of the error message is to unmount and
re-mount the partition again.

Here is how I reproduce the error message:
( /dev/hdc2 on /data type vfat (rw,gid=102,umask=002) )

[frink@truth /data/foo]$\rm -rf *
[frink@truth /data/foo]$touch file <--\__ this order is important
[frink@truth /data/foo]$mkdir dir <--/
[frink@truth /data/foo]$cd dir
[frink@truth /data/foo/dir]$ls
[frink@truth /data/foo/dir]$mv ../file .
[frink@truth /data/foo/dir]$ls
/bin/ls: .: Stale NFS file handle
[frink@truth /data/foo/dir]$

A thread found on google seems to indicate that this problem has been seen
before (January 1999). Has this been discussed recently? Was it fixed and
is appearing again after some other change? For that mater is it present in
the current development kernel?

http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&oe=utf-8&safe=off&frame=right&th=3aea305227e98f93&seekm=fa.ivvetlv.4iinqo%40ifi.uio.no#link1

Thanks,
Chad


Patches used:

[frink@truth /usr/src/linux/fs]$diff -u namei.c.orig namei.c
--- namei.c.orig 2002-11-28 16:53:15.000000000 -0700
+++ namei.c 2003-08-16 17:58:01.000000000 -0600
@@ -634,8 +634,17 @@
*/
dentry = nd->dentry;
if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
+
+ printk(KERN_DEBUG "vfat_NFS_error: (link_path_walk): ");
+
+ if(name)
+ printk("name: '%x' '%s'\n", name, name);
+ else
+ printk("name: NULL\n");
+
err = -ESTALE;
if (!dentry->d_op->d_revalidate(dentry, 0)) {
+ printk(KERN_DEBUG "vfat_NFS_error: calling d_invalidate()\n");
d_invalidate(dentry);
break;
}
@@ -648,6 +657,10 @@
}
path_release(nd);
return_err:
+ if(err == -ESTALE) {
+
+ printk(KERN_DEBUG "vfat_NFS_error: link_path_walk() returning ESTALE\n");
+ }
return err;
}


[frink@truth /usr/src/linux/fs]$diff -u vfat/namei.c.orig vfat/namei.c
--- vfat/namei.c.orig 2002-08-02 18:39:45.000000000 -0600
+++ vfat/namei.c 2003-08-12 20:27:55.000000000 -0600
@@ -75,12 +75,15 @@
static int vfat_revalidate(struct dentry *dentry, int flags)
{
PRINTK1(("vfat_revalidate: %s\n", dentry->d_name.name));
+ printk(KERN_DEBUG "vfat_revalidate: %s\n", dentry->d_name.name);
spin_lock(&dcache_lock);
if (dentry->d_time == dentry->d_parent->d_inode->i_version) {
spin_unlock(&dcache_lock);
+ printk(KERN_DEBUG "vfat_revalidate: return 1\n");
return 1;
}
spin_unlock(&dcache_lock);
+ printk(KERN_DEBUG "vfat_revalidate: return ZERO!\n");
return 0;
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/