diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-02-01 18:13:34 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-02-01 18:13:34 +0000 |
commit | 93b4e6704377c5ff1166010856501183fa43a4f8 (patch) | |
tree | 2423601ca68b59fad3d53a8a0fc088cda3adbee6 /lib | |
parent | ed6efae2dba6143d1c21d82392e1b680aee93b47 (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.
From scw@netbsd.org
Diffstat (limited to 'lib')
-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 bb4c0ac9a9a..89cab031741 100644 --- a/lib/libc/db/mpool/mpool.c +++ b/lib/libc/db/mpool/mpool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpool.c,v 1.7 2002/01/31 03:51:21 millert Exp $ */ +/* $OpenBSD: mpool.c,v 1.8 2002/02/01 18:13:33 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)mpool.c 8.7 (Berkeley) 11/2/95"; #else -static char rcsid[] = "$OpenBSD: mpool.c,v 1.7 2002/01/31 03:51:21 millert Exp $"; +static char rcsid[] = "$OpenBSD: mpool.c,v 1.8 2002/02/01 18:13:33 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -430,6 +430,15 @@ mpool_write(mp, bp) if (pwrite(mp->fd, bp->page, mp->pagesize, off) != 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); } |