diff options
| author | scw <scw@NetBSD.org> | 2000-01-09 19:56:15 +0000 |
|---|---|---|
| committer | scw <scw@NetBSD.org> | 2000-01-09 19:56:15 +0000 |
| commit | 2a8d425699b4883e951a5bdedd2a6c8f5a69434e (patch) | |
| tree | 53375db004e79a3121682f819c30759242121e22 /lib/libc/db/mpool/mpool.c | |
| parent | 3e70433d39a01db07ac9fd998b7b05de05d1c86e (diff) | |
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 (limited to 'lib/libc/db/mpool/mpool.c')
| -rw-r--r-- | lib/libc/db/mpool/mpool.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/libc/db/mpool/mpool.c b/lib/libc/db/mpool/mpool.c index a00518255be..4322ef5f022 100644 --- a/lib/libc/db/mpool/mpool.c +++ b/lib/libc/db/mpool/mpool.c @@ -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 @@ mpool_write(mp, bp) 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); } |
