Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Aug 2020 12:53:16 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364815 - head/sys/kern
Message-ID:  <202008261253.07QCrGWr027859@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Wed Aug 26 12:53:16 2020
New Revision: 364815
URL: https://svnweb.freebsd.org/changeset/base/364815

Log:
  cache: stop null checking in cache_free

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Wed Aug 26 12:52:54 2020	(r364814)
+++ head/sys/kern/vfs_cache.c	Wed Aug 26 12:53:16 2020	(r364815)
@@ -388,8 +388,7 @@ cache_free(struct namecache *ncp)
 {
 	struct namecache_ts *ncp_ts;
 
-	if (ncp == NULL)
-		return;
+	MPASS(ncp != NULL);
 	if ((ncp->nc_flag & NCF_DVDROP) != 0)
 		vdrop(ncp->nc_dvp);
 	if (__predict_false(ncp->nc_flag & NCF_TS)) {
@@ -980,7 +979,8 @@ cache_negative_zap_one(void)
 	}
 	mtx_unlock(blp);
 	mtx_unlock(dvlp);
-	cache_free(ncp);
+	if (ncp != NULL)
+		cache_free(ncp);
 }
 
 /*
@@ -1962,7 +1962,8 @@ cache_enter_dotdot_prep(struct vnode *dvp, struct vnod
 	dvp->v_cache_dd = NULL;
 	vn_seqc_write_end(dvp);
 	cache_enter_unlock(&cel);
-	cache_free(ncp);
+	if (ncp != NULL)
+		cache_free(ncp);
 }
 
 /*
@@ -2158,7 +2159,8 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
 	cache_enter_unlock(&cel);
 	if (numneg * ncnegfactor > lnumcache)
 		cache_negative_zap_one();
-	cache_free(ndd);
+	if (ndd != NULL)
+		cache_free(ndd);
 	return;
 out_unlock_free:
 	cache_enter_unlock(&cel);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008261253.07QCrGWr027859>