Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs be sure to call the pager put with page-aligned ...



details:   https://anonhg.NetBSD.org/src/rev/465085090677
branches:  trunk
changeset: 515463:465085090677
user:      chs <chs%NetBSD.org@localhost>
date:      Wed Sep 26 05:25:03 2001 +0000

description:
be sure to call the pager put with page-aligned offsets.
spotted by Nathan Williams.

while I'm here, move an splbio() so that we don't return without
splx()ing it if there's an error, and don't bother calling the
pager put if the vnode has no pages.

diffstat:

 sys/ufs/ffs/ffs_vnops.c |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (51 lines):

diff -r a4b8cc9b4a8d -r 465085090677 sys/ufs/ffs/ffs_vnops.c
--- a/sys/ufs/ffs/ffs_vnops.c   Wed Sep 26 04:06:43 2001 +0000
+++ b/sys/ufs/ffs/ffs_vnops.c   Wed Sep 26 05:25:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vnops.c,v 1.40 2001/09/22 22:35:19 sommerfeld Exp $        */
+/*     $NetBSD: ffs_vnops.c,v 1.41 2001/09/26 05:25:03 chs Exp $       */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -265,23 +265,25 @@
        if (ap->a_offhi % bsize != 0)
                blk_high++;
 
-       s = splbio();
-
        /*
         * First, flush all pages in range.
         */
 
-       simple_lock(&vp->v_uobj.vmobjlock);
-       error = (vp->v_uobj.pgops->pgo_put)(&vp->v_uobj,
-           ap->a_offlo, ap->a_offhi, PGO_CLEANIT|PGO_SYNCIO);
-       if (error) {
-               return error;
+       if (vp->v_uobj.uo_npages != 0) {
+               simple_lock(&vp->v_uobj.vmobjlock);
+               error = (vp->v_uobj.pgops->pgo_put)(&vp->v_uobj,
+                   trunc_page(ap->a_offlo), round_page(ap->a_offhi),
+                   PGO_CLEANIT|PGO_SYNCIO);
+               if (error) {
+                       return error;
+               }
        }
 
        /*
         * Then, flush indirect blocks.
         */
 
+       s = splbio();
        if (!(ap->a_flags & FSYNC_DATAONLY) && blk_high >= NDADDR) {
                error = ufs_getlbns(vp, blk_high, ia, &num);
                if (error)
@@ -340,7 +342,7 @@
         * Flush all dirty data associated with a vnode.
         */
 
-       if (vp->v_type == VREG) {
+       if (vp->v_uobj.uo_npages != 0) {
                uobj = &vp->v_uobj;
                simple_lock(&uobj->vmobjlock);
                error = (uobj->pgops->pgo_put)(uobj, 0, 0,



Home | Main Index | Thread Index | Old Index