Date: Mon, 9 Mar 2009 17:14:00 +0200 From: Jaakko Heinonen <jh@saunalahti.fi> To: freebsd-fs@FreeBSD.org Subject: [patch] invalidate NFS attribute cache if setattr fails with ESTALE Message-ID: <20090309151400.GA807@a91-153-125-115.elisa-laajakaista.fi> In-Reply-To: <200902192210.n1JMAddn009074@svn.freebsd.org> References: <200902192210.n1JMAddn009074@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090309151400.GA807>