Messages in this thread Patch in this message | | | Date | Sat, 07 Mar 1998 18:12:26 -0500 | From | Bill Hawes <> | Subject | patch for nfs stale filehandle diagnostics |
| |
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--- 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; } | |