git: 72347d73464c - main - nullfs: assert the vnode is not doomed in null_hashget_locked
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 03 Oct 2025 19:22:19 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=72347d73464ccdd361c4d286486b9b4ea8d7c945 commit 72347d73464ccdd361c4d286486b9b4ea8d7c945 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2025-10-01 10:28:48 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> 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); }