From owner-freebsd-fs@FreeBSD.ORG Mon Mar 9 15:14:03 2009 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45C301065690 for ; Mon, 9 Mar 2009 15:14:03 +0000 (UTC) (envelope-from jh@saunalahti.fi) Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116]) by mx1.freebsd.org (Postfix) with ESMTP id 05B1B8FC17 for ; Mon, 9 Mar 2009 15:14:03 +0000 (UTC) (envelope-from jh@saunalahti.fi) Received: from a91-153-125-115.elisa-laajakaista.fi (a91-153-125-115.elisa-laajakaista.fi [91.153.125.115]) by gw02.mail.saunalahti.fi (Postfix) with SMTP id 197C213999E for ; Mon, 9 Mar 2009 17:14:01 +0200 (EET) Date: Mon, 9 Mar 2009 17:14:00 +0200 From: Jaakko Heinonen To: freebsd-fs@FreeBSD.org Message-ID: <20090309151400.GA807@a91-153-125-115.elisa-laajakaista.fi> References: <200902192210.n1JMAddn009074@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200902192210.n1JMAddn009074@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Subject: [patch] invalidate NFS attribute cache if setattr fails with ESTALE X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2009 15:14:03 -0000 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