From 66555ce307049b1db8350a04a3af70277e1aa04b Mon Sep 17 00:00:00 2001 From: dg Date: Thu, 26 Jan 1995 03:34:31 +0000 Subject: [PATCH] Fix problem with freeing busy pages reported by Nick Sayer. Submitted by: John Dyson --- sys/kern/vfs_bio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index d3549245e2a8..680fdce0bacc 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -18,7 +18,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: vfs_bio.c,v 1.24 1995/01/21 06:32:26 ache Exp $ + * $Id: vfs_bio.c,v 1.25 1995/01/24 10:00:43 davidg Exp $ */ /* @@ -888,7 +888,7 @@ allocbuf(struct buf * bp, int size, int vmio) for (i = desiredpages; i < bp->b_npages; i++) { m = bp->b_pages[i]; s = splhigh(); - if ((m->flags & PG_BUSY) || (m->busy != 0)) { + while ((m->flags & PG_BUSY) || (m->busy != 0)) { m->flags |= PG_WANTED; tsleep(m, PVM, "biodep", 0); } @@ -901,8 +901,10 @@ allocbuf(struct buf * bp, int size, int vmio) --m->bmapped; if (m->bmapped == 0) { PAGE_WAKEUP(m); - pmap_page_protect(VM_PAGE_TO_PHYS(m), VM_PROT_NONE); - vm_page_free(m); + if (m->valid == 0) { + pmap_page_protect(VM_PAGE_TO_PHYS(m), VM_PROT_NONE); + vm_page_free(m); + } } bp->b_pages[i] = NULL; }