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
This commit is contained in:
Mateusz Guzik
2025-10-01 10:28:48 +00:00
parent 94aae05138
commit 72347d7346
+15 -12
View File
@@ -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);
}