summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2011-06-27 01:14:25 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2011-06-27 01:14:25 +0000
commitc2adb8e9ae3ae21ebbafbbcd1095d3001dfac88d (patch)
treefd93e1e8615f365bb767f1fbe38fcae352dacd4f /sys/arch/amd64
parent7bd9d49a863c7e7562d8aa52e59f3b1962c75abb (diff)
Ensure we don't re-issue a failed buf without clearing B_ERROR and
b_error. Otherwise a good i/o will appear to have failed. Fixes problem with dkcsum.c being unable to read data to checksum from subsequent devices after an i/o fails. And thus failing to find correct root in some cases. Introduced at k2k11 with buf flags rectification. Scan of all biowait() calls finds no other obvious re-use of a buf that could have error'ed out. Just re-use of bufs that worked. So quick fix pending closer review of all uses. Problem noted by Jens A. Griepen. ok matthew@ deraadt@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/dkcsum.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/dkcsum.c b/sys/arch/amd64/amd64/dkcsum.c
index 31316e62789..22108e837c2 100644
--- a/sys/arch/amd64/amd64/dkcsum.c
+++ b/sys/arch/amd64/amd64/dkcsum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dkcsum.c,v 1.18 2011/04/16 03:21:15 krw Exp $ */
+/* $OpenBSD: dkcsum.c,v 1.19 2011/06/27 01:14:24 krw Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -113,7 +113,8 @@ dkcsumattach(void)
/* Read blocks to cksum. XXX maybe a d_read should be used. */
bp->b_blkno = 0;
bp->b_bcount = bios_cksumlen * DEV_BSIZE;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
+ bp->b_error = 0; /* B_ERROR and b_error may have stale data. */
+ CLR(bp->b_flags, B_READ | B_WRITE | B_DONE | B_ERROR);
SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
bp->b_cylinder = 0;
(*bdsw->d_strategy)(bp);