Re: Stale NFS handles on 2.4.2^H^H^H^H^H2.2.19

Trond Myklebust (trond.myklebust@fys.uio.no)
Thu, 1 Mar 2001 15:13:02 +0100 (CET)


>>>>> " " == Patrick J LoPresti <patl@curl.com> writes:

> Trond Myklebust <trond.myklebust@fys.uio.no> writes:
>> OK. We need the patch I sent last night plus a 1-liner in
>> nfs_inode_is_stale(). That should cover both pathologies. It'll
>> probably clean up the other cases in which people have been
>> reporting -ESTALE errors.

> This would be great!

> Any chance your patches will make it into 2.2.19?

They might if you can confirm that the latest 2.2.19-pre patch + the
appended fix the ESTALE problems.

(I hope there are no typos here. I'm preparing to fly over to the
Connectathon tonight, so I haven't had time to run a test, but the
conversion from 2.4.2 should be trivial...)

Cheers,
Trond

diff -u --recursive --new-file linux-2.2.19-pre14/fs/nfs/inode.c linux-2.2.19-stale/fs/nfs/inode.c
--- linux-2.2.19-pre14/fs/nfs/inode.c Thu Feb 22 20:47:54 2001
+++ linux-2.2.19-stale/fs/nfs/inode.c Thu Mar 1 15:06:52 2001
@@ -689,7 +689,7 @@
if ((fattr->mode & S_IFMT) != (inode->i_mode & S_IFMT))
return 1;

- if (is_bad_inode(inode))
+ if (is_bad_inode(inode) || NFS_STALE(inode))
return 1;

/* Has the filehandle changed? If so is the old one stale? */
@@ -871,7 +871,9 @@
dfprintk(PAGECACHE, "NFS: revalidating (%x/%Ld)\n",
inode->i_dev, (long long)NFS_FILEID(inode));

- if (!inode || is_bad_inode(inode) || NFS_STALE(inode))
+ if (!inode || is_bad_inode(inode))
+ return -ESTALE;
+ if (NFS_STALE(inode) && inode != inode->i_sb->s_root->d_inode)
return -ESTALE;

while (NFS_REVALIDATING(inode)) {
@@ -889,7 +891,8 @@
inode->i_dev, (long long)NFS_FILEID(inode), status);
if (status == -ESTALE) {
NFS_FLAGS(inode) |= NFS_INO_STALE;
- remove_inode_hash(inode);
+ if (inode != inode->i_sb->s_root->d_inode)
+ remove_inode_hash(inode);
}
goto out;
}
@@ -903,6 +906,7 @@
dfprintk(PAGECACHE, "NFS: (%x/%Ld) revalidation complete\n",
inode->i_dev, (long long)NFS_FILEID(inode));

+ NFS_FLAGS(inode) &= ~NFS_INO_STALE;
out:
NFS_FLAGS(inode) &= ~NFS_INO_REVALIDATING;
wake_up(&inode->i_wait);

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