kernel - Make sure invalidated pages are unmapped in rare situation.
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 11 Nov 2010 18:15:46 +0000 (10:15 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 18 Nov 2010 17:43:50 +0000 (09:43 -0800)
* 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.

sys/kern/vfs_bio.c

index 759c85c..fed0981 100644 (file)
@@ -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);