Properly synchronize access to the page's hold_count in vfs_vmio_release().

Reviewed by:	kib
This commit is contained in:
Alan Cox 2010-05-02 19:10:27 +00:00
parent f6ffc3c26b
commit 139a0de7f1

View File

@ -1563,7 +1563,6 @@ vfs_vmio_release(struct buf *bp)
vm_page_t m;
VM_OBJECT_LOCK(bp->b_bufobj->bo_object);
vm_page_lock_queues();
for (i = 0; i < bp->b_npages; i++) {
m = bp->b_pages[i];
bp->b_pages[i] = NULL;
@ -1571,16 +1570,16 @@ vfs_vmio_release(struct buf *bp)
* In order to keep page LRU ordering consistent, put
* everything on the inactive queue.
*/
vm_page_lock(m);
vm_page_lock_queues();
vm_page_unwire(m, 0);
/*
* We don't mess with busy pages, it is
* the responsibility of the process that
* busied the pages to deal with them.
*/
if ((m->oflags & VPO_BUSY) || (m->busy != 0))
continue;
if (m->wire_count == 0) {
if ((m->oflags & VPO_BUSY) == 0 && m->busy == 0 &&
m->wire_count == 0) {
/*
* Might as well free the page if we can and it has
* no valid data. We also free the page if the
@ -1595,8 +1594,9 @@ vfs_vmio_release(struct buf *bp)
vm_page_try_to_cache(m);
}
}
vm_page_unlock_queues();
vm_page_unlock(m);
}
vm_page_unlock_queues();
VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object);
pmap_qremove(trunc_page((vm_offset_t) bp->b_data), bp->b_npages);