From: Matthew Dillon Date: Thu, 11 Nov 2010 18:15:46 +0000 (-0800) Subject: kernel - Make sure invalidated pages are unmapped in rare situation. X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/35c17e277baf61f9579fbc6cd5d01902b65820ea kernel - Make sure invalidated pages are unmapped in rare situation. * vfs_vmio_release() was ignoring pages busied by other MP users while releasing VM pages associated with the buffer cache. This could potentially lead to invalida pages remaining memory mapped. * Ensure that the released pages found to be in this state are still unmapped. --- diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 759c85c0b0..fed0981d2c 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1762,12 +1762,16 @@ vfs_vmio_release(struct buf *bp) vm_page_unwire(m, 1); /* - * We don't mess with busy pages, it is - * the responsibility of the process that - * busied the pages to deal with them. + * We don't mess with busy pages, it is the responsibility + * of the process that busied the pages to deal with them. + * + * However, the caller may have marked the page invalid and + * we must still make sure the page is no longer mapped. */ - if ((m->flags & PG_BUSY) || (m->busy != 0)) + if ((m->flags & PG_BUSY) || (m->busy != 0)) { + vm_page_protect(m, VM_PROT_NONE); continue; + } if (m->wire_count == 0) { vm_page_flag_clear(m, PG_ZERO);