--- src/sys/vm/vm_object.c 2007/03/20 00:55:10 1.30 +++ src/sys/vm/vm_object.c 2007/06/08 02:00:47 1.31 @@ -440,7 +440,7 @@ vm_object_terminate(vm_object_t object) vm_object_count--; crit_exit(); - wakeup(object); + vm_object_dead_wakeup(object); if (object->ref_count != 0) panic("vm_object_terminate2: object with references, ref_count=%d", object->ref_count); @@ -470,6 +470,34 @@ vm_object_terminate_callback(vm_page_t p } /* + * The object is dead but still has an object<->pager association. Sleep + * and return. The caller typically retests the association in a loop. + */ +void +vm_object_dead_sleep(vm_object_t object, const char *wmesg) +{ + crit_enter(); + if (object->handle) { + vm_object_set_flag(object, OBJ_DEADWNT); + tsleep(object, 0, wmesg, 0); + } + crit_exit(); +} + +/* + * Wakeup anyone waiting for the object<->pager disassociation on + * a dead object. + */ +void +vm_object_dead_wakeup(vm_object_t object) +{ + if (object->flags & OBJ_DEADWNT) { + vm_object_clear_flag(object, OBJ_DEADWNT); + wakeup(object); + } +} + +/* * vm_object_page_clean * * Clean all dirty pages in the specified range of object. Leaves page