diff options
author | dg <dg@FreeBSD.org> | 1995-03-20 10:20:42 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-03-20 10:20:42 +0000 |
commit | 5d88c07ee171b82b2785890f74c4a548d181fd81 (patch) | |
tree | e60ea877114d7f2367bff3654ed30287fe16d9b5 | |
parent | b9e7140c7c69e5fff051dbec1cbd376a4f854a3b (diff) | |
download | FreeBSD-src-5d88c07ee171b82b2785890f74c4a548d181fd81.zip FreeBSD-src-5d88c07ee171b82b2785890f74c4a548d181fd81.tar.gz |
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().
-rw-r--r-- | sys/vm/vm_object.c | 12 | ||||
-rw-r--r-- | sys/vm/vnode_pager.c | 14 |
2 files changed, 10 insertions, 16 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index bef90fc..6ac1538 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.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. */ diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 162525f..34ccde5 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.31 1995/03/19 12:36:10 davidg Exp $ + * $Id: vnode_pager.c,v 1.32 1995/03/19 23:46:25 davidg Exp $ */ /* @@ -368,16 +368,6 @@ vnode_pager_setsize(vp, nsize) 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. */ if (nsize < vnp->vnp_size) { @@ -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 |