The branch main has been updated by mjg:

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

commit 1d65a9b47eab75f12fcb5cc7547a69441ef764a3
Author:     Mateusz Guzik <[email protected]>
AuthorDate: 2022-02-09 20:41:24 +0000
Commit:     Mateusz Guzik <[email protected]>
CommitDate: 2022-02-11 12:29:26 +0000

    cache: improve vnode vs name assertion in cache_enter_time
---
 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 e4766194187f..c47f6a0438b1 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))

Reply via email to