1) Added protection against collapsing OBJ_DEAD objects.

2) bump reference counts by 2 instead of 1 so that an object deallocate
   doesn't try to recursively collapse the object.
3) mark pages renamed during the collapse as dirty so that their contents
   are preserved.

Submitted by:	John and me.
This commit is contained in:
David Greenman 1995-02-18 06:48:33 +00:00
parent f4fcba6266
commit 9b4814bba2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6541

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_object.c,v 1.21 1995/02/02 09:08:48 davidg Exp $
* $Id: vm_object.c,v 1.22 1995/02/12 09:19:44 davidg Exp $
*/
/*
@ -263,7 +263,7 @@ vm_object_deallocate(object)
if( robject) {
int s;
robject->ref_count += 2;
object->ref_count += 1;
object->ref_count += 2;
do {
s = splhigh();
@ -278,7 +278,7 @@ vm_object_deallocate(object)
} while( object->paging_in_progress || robject->paging_in_progress);
object->ref_count -= 1;
object->ref_count -= 2;
robject->ref_count -= 2;
if( robject->ref_count == 0) {
vm_object_unlock(object);
@ -1217,6 +1217,7 @@ vm_object_qcollapse(object)
swap_pager_freespace(backing_object->pager,
backing_object->paging_offset + p->offset, PAGE_SIZE);
vm_page_rename(p, object, new_offset);
p->dirty = VM_PAGE_BITS_ALL;
}
}
p = next;
@ -1270,6 +1271,9 @@ vm_object_collapse(object)
if ((backing_object = object->shadow) == NULL)
return;
if ((object->flags & OBJ_DEAD) || (backing_object->flags & OBJ_DEAD))
return;
if (object->paging_in_progress != 0) {
if (backing_object) {
if (vm_object_lock_try(backing_object)) {
@ -1373,6 +1377,7 @@ vm_object_collapse(object)
vm_page_unlock_queues();
} else {
vm_page_rename(p, object, new_offset);
p->dirty = VM_PAGE_BITS_ALL;
}
}
}