aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2025-10-01 10:28:48 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2025-10-03 19:15:34 +0000
commit72347d73464ccdd361c4d286486b9b4ea8d7c945 (patch)
tree28d05f7baf846ff1252a2e39a232dcb9ffa4ada1
parent94aae0513896de398a1feda6cd97f7efa2a5dc2e (diff)
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
-rw-r--r--sys/fs/nullfs/null_subr.c27
1 files 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);
}