The branch main has been updated by mjg:

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

commit 72347d73464ccdd361c4d286486b9b4ea8d7c945
Author:     Mateusz Guzik <[email protected]>
AuthorDate: 2025-10-01 10:28:48 +0000
Commit:     Mateusz Guzik <[email protected]>
CommitDate: 2025-10-03 19:15:34 +0000

    nullfs: assert the vnode is not doomed in null_hashget_locked
    
    While here some style touch ups and fixing a stale name in an assert.
    
    Reviewed by:            kib
    Tested by:              pho (previous version)
    Differential Revision:  https://reviews.freebsd.org/D38761
---
 sys/fs/nullfs/null_subr.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c
index 053614b6910d..4db0bc475791 100644
--- a/sys/fs/nullfs/null_subr.c
+++ b/sys/fs/nullfs/null_subr.c
@@ -96,7 +96,7 @@ null_hashget_locked(struct mount *mp, struct vnode *lowervp)
        struct null_node *a;
        struct vnode *vp;
 
-       ASSERT_VOP_LOCKED(lowervp, "null_hashget");
+       ASSERT_VOP_LOCKED(lowervp, __func__);
        rw_assert(&null_hash_lock, RA_LOCKED);
 
        /*
@@ -107,17 +107,20 @@ null_hashget_locked(struct mount *mp, struct vnode 
*lowervp)
         */
        hd = NULL_NHASH(lowervp);
        LIST_FOREACH(a, hd, null_hash) {
-               if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) {
-                       /*
-                        * Since we have the lower node locked the nullfs
-                        * node can not be in the process of recycling.  If
-                        * it had been recycled before we grabed the lower
-                        * lock it would not have been found on the hash.
-                        */
-                       vp = NULLTOV(a);
-                       vref(vp);
-                       return (vp);
-               }
+               if (a->null_lowervp != lowervp)
+                       continue;
+               /*
+                * Since we have the lower node locked the nullfs
+                * node can not be in the process of recycling.  If
+                * it had been recycled before we grabed the lower
+                * lock it would not have been found on the hash.
+                */
+               vp = NULLTOV(a);
+               VNPASS(!VN_IS_DOOMED(vp), vp);
+               if (vp->v_mount != mp)
+                       continue;
+               vref(vp);
+               return (vp);
        }
        return (NULL);
 }

Reply via email to