summaryrefslogtreecommitdiff
path: root/sys/scsi/cd.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2019-01-20 03:28:20 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2019-01-20 03:28:20 +0000
commit266f1fd54025aeb23ac8f5c70997abcd45bee2cd (patch)
tree16fe0864dda58bf2acdc31248fbff02edaafa02f /sys/scsi/cd.c
parent145437242b0cda5f4644f33b6b86e0c0e08ff95a (diff)
When retiring a SCSI request, sometimes the buf's b_error value is
forcibly set to a value. Make sure that in all those cases the B_ERROR flag is cleared (if b_error is being set to 0) or set (if b_error is being set to non-zero) appropriately. ok dlg@ jmatthew@
Diffstat (limited to 'sys/scsi/cd.c')
-rw-r--r--sys/scsi/cd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 7e0ea441142..d8b60247f2f 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.222 2017/12/30 23:08:29 guenther Exp $ */
+/* $OpenBSD: cd.c,v 1.223 2019/01/20 03:28:19 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -483,9 +483,9 @@ cdstrategy(struct buf *bp)
return;
bad:
- bp->b_flags |= B_ERROR;
+ SET(bp->b_flags, B_ERROR);
bp->b_resid = bp->b_bcount;
- done:
+done:
s = splbio();
biodone(bp);
splx(s);
@@ -616,6 +616,7 @@ cd_buf_done(struct scsi_xfer *xs)
switch (xs->error) {
case XS_NOERROR:
bp->b_error = 0;
+ CLR(bp->b_flags, B_ERROR);
bp->b_resid = xs->resid;
break;
@@ -627,6 +628,7 @@ cd_buf_done(struct scsi_xfer *xs)
error = cd_interpret_sense(xs);
if (error == 0) {
bp->b_error = 0;
+ CLR(bp->b_flags, B_ERROR);
bp->b_resid = xs->resid;
break;
}
@@ -651,7 +653,7 @@ retry:
default:
bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
+ SET(bp->b_flags, B_ERROR);
bp->b_resid = bp->b_bcount;
break;
}