Don't gain/lose an object reference in vnode_pager_setsize(). It will
cause vnode locking problems in vm_object_terminate(). Implement proper vnode locking in vm_object_terminate().
This commit is contained in:
parent
62b71ed629
commit
0426122fa0
@ -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.32 1995/03/16 18:17:21 bde Exp $
|
||||
* $Id: vm_object.c,v 1.33 1995/03/20 02:06:09 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -384,8 +384,8 @@ vm_object_terminate(object)
|
||||
vn_pager_t vnp = object->pager->pg_data;
|
||||
|
||||
vp = vnp->vnp_vp;
|
||||
VOP_FSYNC(vp, NOCRED, MNT_WAIT, NULL);
|
||||
vinvalbuf(vp, 0, NOCRED, NULL, 0, 0);
|
||||
VOP_LOCK(vp);
|
||||
vinvalbuf(vp, V_SAVE, NOCRED, NULL, 0, 0);
|
||||
}
|
||||
/*
|
||||
* Wait until the pageout daemon is through with the object.
|
||||
@ -433,7 +433,11 @@ vm_object_terminate(object)
|
||||
* object are gone, so we don't need to lock it.
|
||||
*/
|
||||
if (vp != NULL) {
|
||||
VOP_UNLOCK(vp);
|
||||
(void) vm_object_page_clean(object, 0, 0, TRUE, TRUE);
|
||||
VOP_LOCK(vp);
|
||||
vinvalbuf(vp, 0, NOCRED, NULL, 0, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -463,6 +467,8 @@ vm_object_terminate(object)
|
||||
vm_object_count--;
|
||||
simple_unlock(&vm_object_list_lock);
|
||||
|
||||
wakeup(object);
|
||||
|
||||
/*
|
||||
* Free the space for the object.
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91
|
||||
* $Id: vnode_pager.c,v 1.31 1995/03/19 12:36:10 davidg Exp $
|
||||
* $Id: vnode_pager.c,v 1.32 1995/03/19 23:46:25 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -367,16 +367,6 @@ vnode_pager_setsize(vp, nsize)
|
||||
if (nsize == vnp->vnp_size)
|
||||
return;
|
||||
|
||||
/*
|
||||
* No object. This can happen during object termination since
|
||||
* vm_object_page_clean is called after the object has been removed
|
||||
* from the hash table, and clean may cause vnode write operations
|
||||
* which can wind up back here.
|
||||
*/
|
||||
object = vm_object_lookup(pager);
|
||||
if (object == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* File has shrunk. Toss any cached pages beyond the new EOF.
|
||||
*/
|
||||
@ -406,8 +396,6 @@ vnode_pager_setsize(vp, nsize)
|
||||
}
|
||||
vnp->vnp_size = (vm_offset_t) nsize;
|
||||
object->size = round_page(nsize);
|
||||
|
||||
vm_object_deallocate(object);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user