Skip to contentSkip to conversation

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

DISCUSSION Trond Myklebust 1 participant 1 message Mar 1, 2001 1 message not in the archive NFS client

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

" " == Patrick J LoPresti <[email protected]> writes:

> Trond Myklebust <[email protected]> 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

fs/nfs/inode.c +7 -3
diff -u --recursive --new-file linux-2.2.19-pre14/fs/nfs/inode.c linux-2.2.19-stale/fs/nfs/inode.c
@@ -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);