diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 5f72506549b..e58d3f33808 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2998,6 +2998,15 @@ cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) } mtx_unlock(blp); } + +void +cache_assert_no_entries(struct vnode *vp) +{ + + VNPASS(TAILQ_EMPTY(&vp->v_cache_dst), vp); + VNPASS(LIST_EMPTY(&vp->v_cache_src), vp); + VNPASS(vp->v_cache_dd == NULL, vp); +} #endif /* diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 63b3c23bd07..167f1904b70 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -676,11 +676,17 @@ void cache_vop_rmdir(struct vnode *dvp, struct vnode *vp); #ifdef INVARIANTS void cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp); +void cache_assert_no_entries(struct vnode *vp); #else static inline void cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) { } + +static inline void +cache_assert_no_entries(struct vnode *vp) +{ +} #endif void cache_fast_lookup_enabled_recalc(void); int change_dir(struct vnode *vp, struct thread *td);