Hold the page queues lock when performing vm_page_clear_dirty() and

vm_page_set_invalid().
This commit is contained in:
Alan Cox 2003-08-23 18:11:53 +00:00
parent 0c5eb28b6b
commit b7ad744dc5
3 changed files with 7 additions and 2 deletions

View File

@ -1351,7 +1351,9 @@ brelse(struct buf * bp)
(PAGE_SIZE - poffset) : resid;
KASSERT(presid >= 0, ("brelse: extra page"));
vm_page_lock_queues();
vm_page_set_invalid(m, poffset, presid);
vm_page_unlock_queues();
if (had_bogus)
printf("avoided corruption bug in bogus_page/brelse code\n");
}

View File

@ -1596,7 +1596,8 @@ vm_page_set_dirty(vm_page_t m, int base, int size)
void
vm_page_clear_dirty(vm_page_t m, int base, int size)
{
GIANT_REQUIRED;
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
m->dirty &= ~vm_page_bits(base, size);
}
@ -1613,8 +1614,8 @@ vm_page_set_invalid(vm_page_t m, int base, int size)
{
int bits;
GIANT_REQUIRED;
bits = vm_page_bits(base, size);
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
m->valid &= ~bits;
m->dirty &= ~bits;
m->object->generation++;

View File

@ -1021,8 +1021,10 @@ vnode_pager_generic_putpages(vp, m, bytecount, flags, rtvals)
maxsize = object->un_pager.vnp.vnp_size - poffset;
ncount = btoc(maxsize);
if ((pgoff = (int)maxsize & PAGE_MASK) != 0) {
vm_page_lock_queues();
vm_page_clear_dirty(m[ncount - 1], pgoff,
PAGE_SIZE - pgoff);
vm_page_unlock_queues();
}
} else {
maxsize = 0;