git: d346e3ac3310 - main - vfs: use cache_assert_no_entries instead of open-coding it

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Wed, 26 Oct 2022 15:54:53 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=d346e3ac33105922a5812d480b49f7dda674d136

commit d346e3ac33105922a5812d480b49f7dda674d136
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-10-26 15:33:47 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-10-26 15:54:19 +0000

    vfs: use cache_assert_no_entries instead of open-coding it
---
 sys/kern/vfs_subr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index a590579a25c0..adf2968e7f56 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1906,14 +1906,13 @@ freevnode(struct vnode *vp)
 	VNASSERT(bo->bo_dirty.bv_cnt == 0, vp, ("dirtybufcnt not 0"));
 	VNASSERT(pctrie_is_empty(&bo->bo_dirty.bv_root), vp,
 	    ("dirty blk trie not empty"));
-	VNASSERT(TAILQ_EMPTY(&vp->v_cache_dst), vp, ("vp has namecache dst"));
-	VNASSERT(LIST_EMPTY(&vp->v_cache_src), vp, ("vp has namecache src"));
-	VNASSERT(vp->v_cache_dd == NULL, vp, ("vp has namecache for .."));
 	VNASSERT(TAILQ_EMPTY(&vp->v_rl.rl_waiters), vp,
 	    ("Dangling rangelock waiters"));
 	VNASSERT((vp->v_iflag & (VI_DOINGINACT | VI_OWEINACT)) == 0, vp,
 	    ("Leaked inactivation"));
 	VI_UNLOCK(vp);
+	cache_assert_no_entries(vp);
+
 #ifdef MAC
 	mac_vnode_destroy(vp);
 #endif