From dd94bc5ce1d2d4e5b70a9cf44509c15d34c57149 Mon Sep 17 00:00:00 2001 From: dg Date: Wed, 11 Jan 1995 20:00:10 +0000 Subject: Fixed a panic that Garrett reported to me...the OBJ_INTERNAL flag wasn't being cleared in some cases for vnode backed objects; we now do this in vnode_pager_alloc proper to guarantee it. Also be more careful in the rcollapse code about messing with busy/bmapped pages. --- sys/vm/vm_object.c | 19 +++++++++++++++---- sys/vm/vnode_pager.c | 3 ++- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'sys/vm') diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 18fcac4..15f3093 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -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.14 1995/01/05 04:30:40 davidg Exp $ + * $Id: vm_object.c,v 1.15 1995/01/09 16:05:49 davidg Exp $ */ /* @@ -1152,20 +1152,30 @@ vm_object_rcollapse(object, sobject) if (backing_object->ref_count != 1) return; + object->ref_count += 2; backing_object->ref_count += 2; + + backing_offset = object->shadow_offset; + size = object->size; + +again: s = splbio(); + /* XXX what about object->paging_in_progress? */ while (backing_object->paging_in_progress) { - tsleep(backing_object, PVM, "rcolow", 0); + tsleep(backing_object, PVM, "rcolpp", 0); } splx(s); - backing_offset = object->shadow_offset; - size = object->size; p = backing_object->memq.tqh_first; while (p) { vm_page_t next; next = p->listq.tqe_next; + + if ((p->flags & PG_BUSY) || p->busy || p->bmapped) { + p = next; + continue; + } pmap_page_protect(VM_PAGE_TO_PHYS(p), VM_PROT_NONE); new_offset = (p->offset - backing_offset); if (p->offset < backing_offset || @@ -1196,6 +1206,7 @@ vm_object_rcollapse(object, sobject) p = next; } backing_object->ref_count -= 2; + object->ref_count -= 2; } /* diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index eedef9e..0693518 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91 - * $Id: vnode_pager.c,v 1.18 1994/11/24 14:43:22 davidg Exp $ + * $Id: vnode_pager.c,v 1.19 1995/01/09 16:06:01 davidg Exp $ */ /* @@ -174,6 +174,7 @@ vnode_pager_alloc(handle, size, prot, offset) */ if ((rtval = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) == 0) { object = vm_object_allocate(round_page(vattr.va_size)); + object->flags &= ~OBJ_INTERNAL; vm_object_enter(object, pager); vm_object_setpager(object, pager, 0, TRUE); } else { -- cgit v1.1