From owner-svn-src-stable@FreeBSD.ORG Tue Dec 9 16:20:58 2008 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC4C81065670; Tue, 9 Dec 2008 16:20:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB2528FC1C; Tue, 9 Dec 2008 16:20:58 +0000 (UTC) (envelope-from kib@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 mB9GKwQk095497; Tue, 9 Dec 2008 16:20:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB9GKwCS095496; Tue, 9 Dec 2008 16:20:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812091620.mB9GKwCS095496@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 9 Dec 2008 16:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185796 - in stable/7/sys: . contrib/pf kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2008 16:20:59 -0000 Author: kib Date: Tue Dec 9 16:20:58 2008 New Revision: 185796 URL: http://svn.freebsd.org/changeset/base/185796 Log: MFC r185557: Prevent creation of the duplicated negative namecache entries. Approved by: re (kensmith) Requested by: jhb Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/vfs_cache.c Modified: stable/7/sys/kern/vfs_cache.c ============================================================================== --- stable/7/sys/kern/vfs_cache.c Tue Dec 9 15:49:02 2008 (r185795) +++ stable/7/sys/kern/vfs_cache.c Tue Dec 9 16:20:58 2008 (r185796) @@ -460,7 +460,7 @@ cache_enter(dvp, vp, cnp) struct vnode *vp; struct componentname *cnp; { - struct namecache *ncp; + struct namecache *ncp, *n2; struct nchashhead *ncpp; u_int32_t hash; int hold; @@ -516,8 +516,6 @@ cache_enter(dvp, vp, cnp) * name. */ if (vp) { - struct namecache *n2; - TAILQ_FOREACH(n2, &vp->v_cache_dst, nc_dst) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && @@ -527,7 +525,16 @@ cache_enter(dvp, vp, cnp) return; } } - } + } else { + TAILQ_FOREACH(n2, &ncneg, nc_dst) { + if (n2->nc_nlen == cnp->cn_namelen && + !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { + CACHE_UNLOCK(); + cache_free(ncp); + return; + } + } + } numcache++; if (!vp) {