patch for nfs stale filehandle diagnostics

Bill Hawes (whawes@star.net)
Sat, 07 Mar 1998 18:12:26 -0500


This is a multi-part message in MIME format.
--------------B21A815457B1428C431C3C8D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The attached minor patch will help diagnose NFS "stale filehandle" errors. When
an error occurs, the patch printks the current filehandle, then attempts to look
up the current filehandle. If the lookup calls fails, the error is printed;
otherwise the new filehandle is displayed.

I think this will hlep distinguish cases in which the file has been deleted or
renamed on the server from whatever other cases cause filehandles to become
stale.

Regards,
Bill
--------------B21A815457B1428C431C3C8D
Content-Type: text/plain; charset=us-ascii; name="nfs_inode89-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="nfs_inode89-patch"

--- fs/nfs/inode.c.old Tue Jan 27 09:36:34 1998
+++ fs/nfs/inode.c Sat Mar 7 14:45:19 1998
@@ -650,10 +650,31 @@
inode->i_ino);
status = nfs_proc_getattr(server, NFS_FH(dentry), &fattr);
if (status) {
+ int error;
+ u32 *fh;
+ struct nfs_fh fhandle;
#ifdef NFS_PARANOIA
printk("nfs_revalidate_inode: %s/%s getattr failed, ino=%ld, error=%d\n",
dentry->d_parent->d_name.name, dentry->d_name.name, inode->i_ino, status);
#endif
+ if (status != -ESTALE)
+ goto out;
+ /*
+ * A "stale filehandle" error ... show the current fh
+ * and find out what the filehandle should be.
+ */
+ fh = (u32 *) NFS_FH(dentry);
+ printk("NFS: bad fh %08x%08x%08x%08x%08x%08x%08x%08x\n",
+ fh[0],fh[1],fh[2],fh[3],fh[4],fh[5],fh[6],fh[7]);
+ error = nfs_proc_lookup(server, NFS_FH(dentry->d_parent),
+ dentry->d_name.name, &fhandle, &fattr);
+ if (error) {
+ printk("NFS: lookup failed, error=%d\n", error);
+ goto out;
+ }
+ fh = (u32 *) &fhandle;
+ printk(" %08x%08x%08x%08x%08x%08x%08x%08x\n",
+ fh[0],fh[1],fh[2],fh[3],fh[4],fh[5],fh[6],fh[7]);
goto out;
}

--------------B21A815457B1428C431C3C8D--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu