[patch] invalidate NFS attribute cache if setattr fails with ESTALE
Jaakko Heinonen
jh at saunalahti.fi
Mon Mar 9 08:14:03 PDT 2009
Hi,
Here is a patch which changes nfs_setattrrpc() to invalidate the NFS
attribute cache in case the RPC failed with ESTALE.
The issue was originally reported by Timo Sirainen in PR kern/123755:
> NFS client: open() a file
> NFS server: unlink() the file
> NFS client: fchown() the file -> ESTALE (as expected)
> NFS client: fstat() the file -> success (not expected)
%%%
Index: sys/nfsclient/nfs_vnops.c
===================================================================
--- sys/nfsclient/nfs_vnops.c (revision 188842)
+++ sys/nfsclient/nfs_vnops.c (working copy)
@@ -838,6 +838,10 @@ nfs_setattrrpc(struct vnode *vp, struct
nfsm_loadattr(vp, NULL);
m_freem(mrep);
nfsmout:
+ /* Invalidate the attribute cache if the NFS file handle is stale. */
+ if (error == ESTALE)
+ np->n_attrstamp = 0;
+
return (error);
}
%%%
Could someone take a look if this could be committed?
--
Jaakko
More information about the freebsd-fs
mailing list