From owner-svn-src-head@FreeBSD.ORG Tue Mar 10 18:41:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73E9F106566B; Tue, 10 Mar 2009 18:41:07 +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 7F46D8FC1C; Tue, 10 Mar 2009 18:41:06 +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 n2AIf66p070378; Tue, 10 Mar 2009 18:41:06 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2AIf6si070377; Tue, 10 Mar 2009 18:41:06 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903101841.n2AIf6si070377@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 18:41:06 +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: r189639 - head/sys/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2009 18:41:08 -0000 Author: jhb Date: Tue Mar 10 18:41:06 2009 New Revision: 189639 URL: http://svn.freebsd.org/changeset/base/189639 Log: - Remove code to set SAVENAME for CREATE or RENAME requests that get a -ve hit in the name cache. cache_lookup() doesn't actually return ENOENT for such requests to force the filesystem to do an explicit lookup, so this was effectively dead code. - Grab the nfsnode mutex while writing to n_dmtime. We don't grab the lock when comparing the time against the cached directory mod time (just as we don't when comparing ctime's for +ve name cache hits) since the attribute caching is already racy for NFS clients as it is. Discussed with: bde Modified: head/sys/nfsclient/nfs_vnops.c Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Tue Mar 10 18:16:03 2009 (r189638) +++ head/sys/nfsclient/nfs_vnops.c Tue Mar 10 18:41:06 2009 (r189639) @@ -923,14 +923,12 @@ nfs_lookup(struct vop_lookup_args *ap) if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && vattr.va_mtime.tv_sec == np->n_dmtime) { nfsstats.lookupcache_hits++; - if ((cnp->cn_nameiop == CREATE || - cnp->cn_nameiop == RENAME) && - (flags & ISLASTCN)) - cnp->cn_flags |= SAVENAME; return (ENOENT); } cache_purge_negative(dvp); + mtx_lock(&np->n_mtx); np->n_dmtime = 0; + mtx_unlock(&np->n_mtx); } error = 0; newvp = NULLVP; @@ -1041,8 +1039,10 @@ nfsmout: * name cache entry for this directory was * added. */ + mtx_lock(&np->n_mtx); if (np->n_dmtime == 0) np->n_dmtime = np->n_vattr.va_mtime.tv_sec; + mtx_unlock(&np->n_mtx); cache_enter(dvp, NULL, cnp); } return (ENOENT);