Module Name:    src
Committed By:   pooka
Date:           Tue Mar  1 10:02:11 UTC 2011

Modified Files:
        src/sys/rump/librump/rumpvfs: vm_vfs.c

Log Message:
Pass accurate protection info from ubc_uiomove() to the pager.
Fixes nfs{,ro}_fileio tests on at least sparc64 (and probably macppc
and other fat endian machines).

The problem was that nfs was fooled to thinking read() caused a
write fault because of VM_PROT_WRITE being unconditionally set and
therefore set NMODIFIED on a r/o file system.  It is absolutely
beyond me why the test worked on i386/amd64.  Incidentally, I seem
to have "misplaced" a few goats.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/rump/librump/rumpvfs/vm_vfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/librump/rumpvfs/vm_vfs.c
diff -u src/sys/rump/librump/rumpvfs/vm_vfs.c:1.26 src/sys/rump/librump/rumpvfs/vm_vfs.c:1.27
--- src/sys/rump/librump/rumpvfs/vm_vfs.c:1.26	Sun Feb 27 13:37:39 2011
+++ src/sys/rump/librump/rumpvfs/vm_vfs.c	Tue Mar  1 10:02:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_vfs.c,v 1.26 2011/02/27 13:37:39 pooka Exp $	*/
+/*	$NetBSD: vm_vfs.c,v 1.27 2011/03/01 10:02:11 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.26 2011/02/27 13:37:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.27 2011/03/01 10:02:11 pooka Exp $");
 
 #include <sys/param.h>
 
@@ -173,6 +173,7 @@
 	int npages = len2npages(uio->uio_offset, todo);
 	size_t pgalloc;
 	int i, rv, pagerflags;
+	vm_prot_t prot;
 
 	pgalloc = npages * sizeof(pgs);
 	pgs = kmem_alloc(pgalloc, KM_SLEEP);
@@ -183,13 +184,16 @@
 	if (flags & UBC_FAULTBUSY)
 		pagerflags |= PGO_OVERWRITE;
 
+	prot = VM_PROT_READ;
+	if (flags & UBC_WRITE)
+		prot |= VM_PROT_WRITE;
+
 	mutex_enter(&uobj->vmobjlock);
 	do {
 		npages = len2npages(uio->uio_offset, todo);
 		memset(pgs, 0, pgalloc);
 		rv = uobj->pgops->pgo_get(uobj, trunc_page(uio->uio_offset),
-		    pgs, &npages, 0, VM_PROT_READ | VM_PROT_WRITE, 0,
-		    pagerflags);
+		    pgs, &npages, 0, prot, 0, pagerflags);
 		if (rv)
 			goto out;
 

Reply via email to