From owner-svn-src-head@freebsd.org Thu Jul 2 12:56:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99071355F0B; Thu, 2 Jul 2020 12:56:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49yJ4j3X0Jz3Y87; Thu, 2 Jul 2020 12:56:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C2C01AF38; Thu, 2 Jul 2020 12:56:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 062CuLPW086933; Thu, 2 Jul 2020 12:56:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062CuLar086932; Thu, 2 Jul 2020 12:56:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007021256.062CuLar086932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 2 Jul 2020 12:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362889 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 02 Jul 2020 12:56:21 -0000 Author: mjg Date: Thu Jul 2 12:56:20 2020 New Revision: 362889 URL: https://svnweb.freebsd.org/changeset/base/362889 Log: cache: add missing call to cache_ncp_invalid for negative hits Note the dtrace probe can fire even the entry is gone, but I don't think that's worth fixing. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Jul 2 12:54:50 2020 (r362888) +++ head/sys/kern/vfs_cache.c Thu Jul 2 12:56:20 2020 (r362889) @@ -1342,7 +1342,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st uint32_t hash; enum vgetstate vs; int error, ltype; - bool try_smr, doing_smr; + bool try_smr, doing_smr, whiteout; #ifdef DEBUG_CACHE if (__predict_false(!doingcache)) { @@ -1498,28 +1498,28 @@ negative_success: goto zap_and_exit; } + SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); + cache_out_ts(ncp, tsp, ticksp); + counter_u64_add(numneghits, 1); + whiteout = (ncp->nc_flag & NCF_WHITE); + if (doing_smr) { - if ((ncp->nc_flag & NCF_HOTNEGATIVE) == 0) { - /* - * We need to take locks to promote the entry. - */ + /* + * We need to take locks to promote an entry. + */ + if ((ncp->nc_flag & NCF_HOTNEGATIVE) == 0 || + cache_ncp_invalid(ncp)) { vfs_smr_exit(); doing_smr = false; goto retry_hashed; } + vfs_smr_exit(); } else { cache_negative_hit(ncp); + cache_lookup_unlock(blp, dvlp); } - counter_u64_add(numneghits, 1); - if (ncp->nc_flag & NCF_WHITE) + if (whiteout) cnp->cn_flags |= ISWHITEOUT; - SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, - ncp->nc_name); - cache_out_ts(ncp, tsp, ticksp); - if (doing_smr) - vfs_smr_exit(); - else - cache_lookup_unlock(blp, dvlp); return (ENOENT); zap_and_exit: