Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/db/mpool After writing a page out to disk, run the ...



details:   https://anonhg.NetBSD.org/src/rev/1ec480930e96
branches:  trunk
changeset: 480348:1ec480930e96
user:      scw <scw%NetBSD.org@localhost>
date:      Sun Jan 09 19:56:15 2000 +0000

description:
After writing a page out to disk, run the page back through the user's
input filter to ensure we don't end up with a cached copy of the page
in the wrong byte-order for the host cpu.

This fixes a fatal bug which bites when the DB 'lorder' is different
to the cpu's, and a cached page is accessed soon after it was flushed
to disk.

diffstat:

 lib/libc/db/mpool/mpool.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 99e02eb64bff -r 1ec480930e96 lib/libc/db/mpool/mpool.c
--- a/lib/libc/db/mpool/mpool.c Sun Jan 09 18:56:37 2000 +0000
+++ b/lib/libc/db/mpool/mpool.c Sun Jan 09 19:56:15 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpool.c,v 1.10 1998/12/09 12:42:51 christos Exp $      */
+/*     $NetBSD: mpool.c,v 1.11 2000/01/09 19:56:15 scw Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)mpool.c    8.5 (Berkeley) 7/26/94";
 #else
-__RCSID("$NetBSD: mpool.c,v 1.10 1998/12/09 12:42:51 christos Exp $");
+__RCSID("$NetBSD: mpool.c,v 1.11 2000/01/09 19:56:15 scw Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -400,6 +400,15 @@
        if (pwrite(mp->fd, bp->page, (size_t)mp->pagesize, off) != (int)mp->pagesize)
                return (RET_ERROR);
 
+       /*
+        * Re-run through the input filter since this page may soon be
+        * accessed via the cache, and whatever the user's output filter
+        * did may screw things up if we don't let the input filter
+        * restore the in-core copy.
+        */
+       if (mp->pgin)
+               (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
+
        bp->flags &= ~MPOOL_DIRTY;
        return (RET_SUCCESS);
 }



Home | Main Index | Thread Index | Old Index