git: d6132e2117b7 - stable/13 - cache: improve vnode vs name assertion in cache_enter_time
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 05 Mar 2022 19:56:55 UTC
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d6132e2117b7f035a3d73b5cbb34d609aa58f212 commit d6132e2117b7f035a3d73b5cbb34d609aa58f212 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2022-02-09 20:41:24 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2022-03-05 19:53:46 +0000 cache: improve vnode vs name assertion in cache_enter_time (cherry picked from commit 1d65a9b47eab75f12fcb5cc7547a69441ef764a3) --- sys/kern/vfs_cache.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 780b5003749b..52ed0756db25 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2387,18 +2387,21 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, KASSERT(cnp->cn_namelen <= NAME_MAX, ("%s: passed len %ld exceeds NAME_MAX (%d)", __func__, cnp->cn_namelen, NAME_MAX)); -#ifdef notyet - /* - * Not everything doing this is weeded out yet. - */ - VNPASS(dvp != vp, dvp); -#endif VNPASS(!VN_IS_DOOMED(dvp), dvp); VNPASS(dvp->v_type != VNON, dvp); if (vp != NULL) { VNPASS(!VN_IS_DOOMED(vp), vp); VNPASS(vp->v_type != VNON, vp); } + if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { + KASSERT(dvp == vp, + ("%s: different vnodes for dot entry (%p; %p)\n", __func__, + dvp, vp)); + } else { + KASSERT(dvp != vp, + ("%s: same vnode for non-dot entry [%s] (%p)\n", __func__, + cnp->cn_nameptr, dvp)); + } #ifdef DEBUG_CACHE if (__predict_false(!doingcache))