diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-07 15:38:44 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-07 15:38:44 +0000 |
commit | 86458c6417bd69b9a3eba372332f057830e88cac (patch) | |
tree | 6d3303b106872321249fec46ef7c7896878d0a11 /sys | |
parent | 533af00bc490d661c0485172ecc85661f5bfb8b2 (diff) |
Make sure the scsi_xfer timeout is set up before the command may complete;
similar fix to osiop.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/oosiop.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/dev/ic/oosiop.c b/sys/dev/ic/oosiop.c index d7206b19d02..ed15b9d35f4 100644 --- a/sys/dev/ic/oosiop.c +++ b/sys/dev/ic/oosiop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: oosiop.c,v 1.11 2009/02/16 21:19:07 miod Exp $ */ +/* $OpenBSD: oosiop.c,v 1.12 2009/03/07 15:38:43 miod Exp $ */ /* $NetBSD: oosiop.c,v 1.4 2003/10/29 17:45:55 tsutsui Exp $ */ /* @@ -719,6 +719,7 @@ oosiop_scsicmd(struct scsi_xfer *xs) struct oosiop_cb *cb; struct oosiop_xfer *xfer; int s, err; + int dopoll; sc = (struct oosiop_softc *)xs->sc_link->adapter_softc; @@ -779,28 +780,32 @@ oosiop_scsicmd(struct scsi_xfer *xs) xfer->status = SCSI_OOSIOP_NOSTATUS; - splx(s); - - oosiop_setup(sc, cb); - /* * Always initialize timeout so it does not contain trash * that could confuse timeout_del(). */ timeout_set(&xs->stimeout, oosiop_timeout, cb); + if (xs->flags & SCSI_POLL) + dopoll = 1; + else { + dopoll = 0; + /* start expire timer */ + timeout_add_msec(&xs->stimeout, xs->timeout); + } + + splx(s); + + oosiop_setup(sc, cb); + TAILQ_INSERT_TAIL(&sc->sc_cbq, cb, chain); if (!sc->sc_active) { /* Abort script to start selection */ oosiop_write_1(sc, OOSIOP_ISTAT, OOSIOP_ISTAT_ABRT); } - if (xs->flags & SCSI_POLL) + if (dopoll) oosiop_poll(sc, cb); - else { - /* start expire timer */ - timeout_add_msec(&xs->stimeout, xs->timeout); - } if (xs->flags & (SCSI_POLL | ITSDONE)) return (COMPLETE); |