From owner-svn-src-all@FreeBSD.ORG Mon Apr 6 21:11:09 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F9CA1065717; Mon, 6 Apr 2009 21:11:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F09AE8FC13; Mon, 6 Apr 2009 21:11:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n36LB82w083548; Mon, 6 Apr 2009 21:11:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n36LB8Eh083543; Mon, 6 Apr 2009 21:11:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200904062111.n36LB8Eh083543@svn.freebsd.org> From: John Baldwin Date: Mon, 6 Apr 2009 21:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190785 - in head/sys: nfs4client nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2009 21:11:10 -0000 Author: jhb Date: Mon Apr 6 21:11:08 2009 New Revision: 190785 URL: http://svn.freebsd.org/changeset/base/190785 Log: When a stale file handle is encountered, purge all cached information about an NFS node including the access and attribute caches. Previously the NFS client only purged any name cache entries associated with the file. PR: kern/123755 Submitted by: Jaakko Heinonen jh of saunalahti fi Reported by: Timo Sirainen tss of iki fi Reviewed by: rwatson, rmacklem MFC after: 1 month Modified: head/sys/nfs4client/nfs4_socket.c head/sys/nfsclient/nfs.h head/sys/nfsclient/nfs_krpc.c head/sys/nfsclient/nfs_socket.c head/sys/nfsclient/nfs_subs.c Modified: head/sys/nfs4client/nfs4_socket.c ============================================================================== --- head/sys/nfs4client/nfs4_socket.c Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfs4client/nfs4_socket.c Mon Apr 6 21:11:08 2009 (r190785) @@ -259,7 +259,7 @@ nfs4_request(struct vnode *vp, struct mb ** lookup cache, just in case. **/ if (error == ESTALE) - cache_purge(vp); + nfs_purgecache(vp); return (error); } Modified: head/sys/nfsclient/nfs.h ============================================================================== --- head/sys/nfsclient/nfs.h Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfsclient/nfs.h Mon Apr 6 21:11:08 2009 (r190785) @@ -322,6 +322,7 @@ void nfs_down(struct nfsreq *, struct nf #endif /* ! NFS4_USE_RPCCLNT */ #endif +void nfs_purgecache(struct vnode *); int nfs_vinvalbuf(struct vnode *, int, struct thread *, int); int nfs_readrpc(struct vnode *, struct uio *, struct ucred *); int nfs_writerpc(struct vnode *, struct uio *, struct ucred *, int *, Modified: head/sys/nfsclient/nfs_krpc.c ============================================================================== --- head/sys/nfsclient/nfs_krpc.c Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfsclient/nfs_krpc.c Mon Apr 6 21:11:08 2009 (r190785) @@ -557,7 +557,7 @@ tryagain: * cache, just in case. */ if (error == ESTALE) - cache_purge(vp); + nfs_purgecache(vp); /* * Skip wcc data on NFS errors for now. NetApp filers * return corrupt postop attrs in the wcc data for NFS Modified: head/sys/nfsclient/nfs_socket.c ============================================================================== --- head/sys/nfsclient/nfs_socket.c Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfsclient/nfs_socket.c Mon Apr 6 21:11:08 2009 (r190785) @@ -1364,7 +1364,7 @@ wait_for_pinned_req: * lookup cache, just in case. */ if (error == ESTALE) - cache_purge(vp); + nfs_purgecache(vp); /* * Skip wcc data on NFS errors for now. NetApp filers return corrupt * postop attrs in the wcc data for NFS err EROFS. Not sure if they Modified: head/sys/nfsclient/nfs_subs.c ============================================================================== --- head/sys/nfsclient/nfs_subs.c Mon Apr 6 20:17:28 2009 (r190784) +++ head/sys/nfsclient/nfs_subs.c Mon Apr 6 21:11:08 2009 (r190785) @@ -865,6 +865,29 @@ nfs_getattrcache(struct vnode *vp, struc return (0); } +/* + * Purge all cached information about an NFS vnode including name + * cache entries, the attribute cache, and the access cache. This is + * called when an NFS request for a node fails with a stale + * filehandle. + */ +void +nfs_purgecache(struct vnode *vp) +{ + struct nfsnode *np; + int i; + + np = VTONFS(vp); + cache_purge(vp); + mtx_lock(&np->n_mtx); + np->n_attrstamp = 0; + KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); + for (i = 0; i < NFS_ACCESSCACHESIZE; i++) + np->n_accesscache[i].stamp = 0; + KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp); + mtx_unlock(&np->n_mtx); +} + static nfsuint64 nfs_nullcookie = { { 0, 0 } }; /* * This function finds the directory cookie that corresponds to the