diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index cc76a3cba4bb..1ec7ea32279a 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1353,9 +1353,7 @@ 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"); } diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 1c877d932c28..0d5b393eac1a 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2160,10 +2160,13 @@ vm_page_set_invalid(vm_page_t m, int base, int size) int bits; VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + KASSERT((m->oflags & VPO_BUSY) == 0, + ("vm_page_set_invalid: page %p is busy", m)); bits = vm_page_bits(base, size); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); if (m->valid == VM_PAGE_BITS_ALL && bits != 0) pmap_remove_all(m); + KASSERT(!pmap_page_is_mapped(m), + ("vm_page_set_invalid: page %p is mapped", m)); m->valid &= ~bits; m->dirty &= ~bits; m->object->generation++; @@ -2241,9 +2244,10 @@ vm_page_is_valid(vm_page_t m, int base, int size) void vm_page_test_dirty(vm_page_t m) { - if ((m->dirty != VM_PAGE_BITS_ALL) && pmap_is_modified(m)) { + + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + if (m->dirty != VM_PAGE_BITS_ALL && pmap_is_modified(m)) vm_page_dirty(m); - } } int so_zerocp_fullpage = 0;