tmpfs: recalculate OBJ_TMPFS_VREF on reinstantiating node' vnode

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45119
This commit is contained in:
Konstantin Belousov 2024-05-06 21:31:31 +03:00
parent 663838451e
commit 58d7ac11e7

View File

@ -1094,15 +1094,19 @@ loop:
KASSERT((object->flags & OBJ_TMPFS_VREF) == 0,
("%s: object %p with OBJ_TMPFS_VREF but without vnode",
__func__, object));
KASSERT(object->un_pager.swp.writemappings == 0,
("%s: object %p has writemappings",
__func__, object));
VI_LOCK(vp);
KASSERT(vp->v_object == NULL, ("Not NULL v_object in tmpfs"));
vp->v_object = object;
vn_irflag_set_locked(vp, (tm->tm_pgread ? VIRF_PGREAD : 0) |
VIRF_TEXT_REF);
VI_UNLOCK(vp);
VNASSERT((object->flags & OBJ_TMPFS_VREF) == 0, vp,
("leaked OBJ_TMPFS_VREF"));
if (object->un_pager.swp.writemappings > 0) {
vrefact(vp);
vlazy(vp);
vm_object_set_flag(object, OBJ_TMPFS_VREF);
}
VM_OBJECT_WUNLOCK(object);
break;
case VDIR: