diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-20 03:28:20 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-20 03:28:20 +0000 |
commit | 266f1fd54025aeb23ac8f5c70997abcd45bee2cd (patch) | |
tree | 16fe0864dda58bf2acdc31248fbff02edaafa02f /sys/scsi/st.c | |
parent | 145437242b0cda5f4644f33b6b86e0c0e08ff95a (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/st.c')
-rw-r--r-- | sys/scsi/st.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/scsi/st.c b/sys/scsi/st.c index 3f88efd1c58..0335175bd03 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -1,4 +1,4 @@ -/* $OpenBSD: st.c,v 1.134 2017/09/08 05:36:53 deraadt Exp $ */ +/* $OpenBSD: st.c,v 1.135 2019/01/20 03:28:19 krw Exp $ */ /* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */ /* @@ -883,7 +883,7 @@ ststrategy(struct buf *bp) device_unref(&st->sc_dev); return; bad: - bp->b_flags |= B_ERROR; + SET(bp->b_flags, B_ERROR); done: /* Set b_resid to indicate no xfer was done. */ bp->b_resid = bp->b_bcount; @@ -948,7 +948,7 @@ ststart(struct scsi_xfer *xs) * Back up over filemark */ if (st_space(st, 0, SP_FILEMARKS, 0)) { - bp->b_flags |= B_ERROR; + SET(bp->b_flags, B_ERROR); bp->b_resid = bp->b_bcount; bp->b_error = EIO; s = splbio(); @@ -959,7 +959,7 @@ ststart(struct scsi_xfer *xs) } else { bp->b_resid = bp->b_bcount; bp->b_error = 0; - bp->b_flags &= ~B_ERROR; + CLR(bp->b_flags, B_ERROR); st->flags &= ~ST_AT_FILEMARK; s = splbio(); biodone(bp); @@ -977,7 +977,7 @@ ststart(struct scsi_xfer *xs) bp->b_resid = bp->b_bcount; if (st->flags & ST_EIO_PENDING) { bp->b_error = EIO; - bp->b_flags |= B_ERROR; + SET(bp->b_flags, B_ERROR); } st->flags &= ~(ST_EOM_PENDING | ST_EIO_PENDING); s = splbio(); @@ -1052,6 +1052,7 @@ st_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; @@ -1063,6 +1064,7 @@ st_buf_done(struct scsi_xfer *xs) error = st_interpret_sense(xs); if (error == 0) { bp->b_error = 0; + CLR(bp->b_flags, B_ERROR); bp->b_resid = xs->resid; break; } @@ -1087,7 +1089,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; } |