Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/librump/rumpvfs Pass accurate protection info from ...



details:   https://anonhg.NetBSD.org/src/rev/ef075765b617
branches:  trunk
changeset: 762805:ef075765b617
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Mar 01 10:02:11 2011 +0000

description:
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.

diffstat:

 sys/rump/librump/rumpvfs/vm_vfs.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r fcc491a01819 -r ef075765b617 sys/rump/librump/rumpvfs/vm_vfs.c
--- a/sys/rump/librump/rumpvfs/vm_vfs.c Tue Mar 01 09:17:06 2011 +0000
+++ b/sys/rump/librump/rumpvfs/vm_vfs.c Tue Mar 01 10:02:11 2011 +0000
@@ -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;
 



Home | Main Index | Thread Index | Old Index