Source-Changes-HG archive

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

[src/uebayasi-xip]: src/sys/miscfs/genfs genfs_do_getpages_xip1: Adjust locki...



details:   https://anonhg.NetBSD.org/src/rev/48d9d22d20d0
branches:  uebayasi-xip
changeset: 751804:48d9d22d20d0
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Mon Sep 27 08:25:37 2010 +0000

description:
genfs_do_getpages_xip1: Adjust locking.  Although XIP never does real I/O,
it's called without PGO_LOCKED in some cases.  Leave vmobjlock unlocked in
that case.

diffstat:

 sys/miscfs/genfs/genfs_io.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (61 lines):

diff -r e938aec0ba9d -r 48d9d22d20d0 sys/miscfs/genfs/genfs_io.c
--- a/sys/miscfs/genfs/genfs_io.c       Sun Sep 26 15:18:11 2010 +0000
+++ b/sys/miscfs/genfs/genfs_io.c       Mon Sep 27 08:25:37 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_io.c,v 1.36.2.25 2010/09/26 15:18:11 uebayasi Exp $      */
+/*     $NetBSD: genfs_io.c,v 1.36.2.26 2010/09/27 08:25:37 uebayasi Exp $      */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.25 2010/09/26 15:18:11 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.26 2010/09/27 08:25:37 uebayasi Exp $");
 
 #include "opt_xip.h"
 
@@ -832,8 +832,8 @@
        UVMHIST_LOG(ubchist, "xip npages=%d sbkoff=%lx ebkoff=%lx",
            npages, (long)sbkoff, (long)ebkoff, 0);
 
-       if ((flags & PGO_LOCKED) == 0)
-               mutex_exit(&uobj->vmobjlock);
+       KASSERT(mutex_owned(&uobj->vmobjlock));
+       mutex_exit(&uobj->vmobjlock);
 
        off = offset;
        for (i = 0; i < npages; i++) {
@@ -896,9 +896,7 @@
                off += PAGE_SIZE;
        }
 
-       if ((flags & PGO_LOCKED) == 0)
-               mutex_enter(&uobj->vmobjlock);
-       KASSERT(mutex_owned(&uobj->vmobjlock));
+       mutex_enter(&uobj->vmobjlock);
 
        for (i = 0; i < npages; i++) {
                struct vm_page *pg = pps[i];
@@ -1519,10 +1517,12 @@
                        npages = maxpages;
 
                orignpages = npages;
+               KASSERT(mutex_owned(&uobj->vmobjlock));
                error = genfs_do_getpages_xip1(vp, off, pgs, &npages, 0,
                    VM_PROT_ALL, 0, PGO_LOCKED);
                KASSERT(error == 0);
                KASSERT(npages == orignpages);
+               KASSERT(mutex_owned(&uobj->vmobjlock));
                for (i = 0; i < npages; i++) {
                        pg = pgs[i];
                        if (pg == NULL || pg == PGO_DONTCARE)
@@ -1559,6 +1559,7 @@
        KASSERT(uobj->uo_npages == 0);
 
 done:
+       KASSERT(mutex_owned(&uobj->vmobjlock));
        mutex_exit(&uobj->vmobjlock);
        return 0;
 }



Home | Main Index | Thread Index | Old Index