diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index c59f81adae82..b65a2a374caf 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -237,6 +237,12 @@ vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, * Object has been created while we were sleeping */ VI_UNLOCK(vp); + VM_OBJECT_WLOCK(object); + KASSERT(object->ref_count == 1, + ("leaked ref %p %d", object, object->ref_count)); + object->type = OBJT_DEAD; + object->ref_count = 0; + VM_OBJECT_WUNLOCK(object); vm_object_destroy(object); goto retry; }