From 7e1b20a4cf1d87eeb140e7074047009ad370c652 Mon Sep 17 00:00:00 2001 From: yamt Date: Sat, 30 Sep 2006 15:37:22 +0000 Subject: [PATCH] ubc_fault: check UVM_OBJ_NEEDS_WRITEFAULT. fix an assertion failure in genfs_putpages when using msdosfs. (http://mail-index.NetBSD.org/tech-kern/2006/09/27/0002.html) reported and tested by Darrin B.Jewell. --- sys/uvm/uvm_bio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/uvm/uvm_bio.c b/sys/uvm/uvm_bio.c index f8d18e823ead..111f5d2b6bcb 100644 --- a/sys/uvm/uvm_bio.c +++ b/sys/uvm/uvm_bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_bio.c,v 1.48 2006/09/03 21:33:33 christos Exp $ */ +/* $NetBSD: uvm_bio.c,v 1.49 2006/09/30 15:37:22 yamt Exp $ */ /* * Copyright (c) 1998 Chuck Silvers. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.48 2006/09/03 21:33:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.49 2006/09/30 15:37:22 yamt Exp $"); #include "opt_uvmhist.h" @@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.48 2006/09/03 21:33:33 christos Exp $" #include #include #include +#include #include @@ -356,8 +357,9 @@ again: * is marked as PG_RDONLY. */ - rdonly = (access_type & VM_PROT_WRITE) == 0 && - (pg->flags & PG_RDONLY) != 0; + rdonly = ((access_type & VM_PROT_WRITE) == 0 && + (pg->flags & PG_RDONLY) != 0) || + UVM_OBJ_NEEDS_WRITEFAULT(uobj); KASSERT((pg->flags & PG_RDONLY) == 0 || (access_type & VM_PROT_WRITE) == 0 || pg->offset < umap->writeoff ||