summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2010-06-16 00:20:07 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2010-06-16 00:20:07 +0000
commitafcf029edf8d2992f11744bd08e543f4c39f9c80 (patch)
tree722e506bbf2acdccd8c064674fad27c76bbcb16b /sys
parentf5f69b657719e6189ecc259f7556a91ba62ff408 (diff)
Bring ststrategy() into line with sdstrategy() and cdstrategy(), making
sure buf's are correctly completed. Feedback from Matthew Dempsky. ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/st.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index fe5172c061f..6181cd0761d 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.97 2010/06/15 04:11:34 dlg Exp $ */
+/* $OpenBSD: st.c,v 1.98 2010/06/16 00:20:06 krw Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -833,14 +833,16 @@ ststrategy(struct buf *bp)
{
struct scsi_link *sc_link;
struct st_softc *st;
- int error, s;
+ int s;
st = stlookup(STUNIT(bp->b_dev));
- if (st == NULL)
- return;
+ if (st == NULL) {
+ bp->b_error = ENXIO;
+ goto bad;
+ }
if (st->flags & ST_DYING) {
- error = ENXIO;
- goto done;
+ bp->b_error = ENXIO;
+ goto bad;
}
sc_link = st->sc_link;
@@ -897,14 +899,13 @@ ststrategy(struct buf *bp)
bad:
bp->b_flags |= B_ERROR;
done:
- device_unref(&st->sc_dev);
- /*
- * Correctly set the buf to indicate a completed xfer
- */
+ /* Set b_resid to indicate no xfer was done. */
bp->b_resid = bp->b_bcount;
s = splbio();
biodone(bp);
splx(s);
+ if (st)
+ device_unref(&st->sc_dev);
}
/*