diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-01-11 00:44:41 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-01-11 00:44:41 +0000 |
commit | 1d4431aaa348883cd71f273a3e0f6af06cf43069 (patch) | |
tree | 24e9ced27bbe88490952bf1d422a96826e19c675 | |
parent | e07b6aa29d06e6effef2610b32d4218dc4831d2f (diff) |
Be as careful with sd/cd buf queue manipulations as was found necessary for
st's queue manipulations. i.e. ensure b_actb is correctly updated as the
queue becomes empty or has an i/o requeued on it.
Tested on claudio@'s backup crashing box.
ok dlg@ beck@
-rw-r--r-- | sys/scsi/cd.c | 6 | ||||
-rw-r--r-- | sys/scsi/sd.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 49ab9d6f73b..2ea0cbddcef 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.158 2010/01/09 21:12:06 dlg Exp $ */ +/* $OpenBSD: cd.c,v 1.159 2010/01/11 00:44:40 krw Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -561,6 +561,8 @@ cd_buf_dequeue(struct cd_softc *sc) bp = sc->sc_buf_queue.b_actf; if (bp != NULL) sc->sc_buf_queue.b_actf = bp->b_actf; + if (sc->sc_buf_queue.b_actf == NULL) + sc->sc_buf_queue.b_actb = &sc->sc_buf_queue.b_actf; mtx_leave(&sc->sc_queue_mtx); return (bp); @@ -572,6 +574,8 @@ cd_buf_requeue(struct cd_softc *sc, struct buf *bp) mtx_enter(&sc->sc_queue_mtx); bp->b_actf = sc->sc_buf_queue.b_actf; sc->sc_buf_queue.b_actf = bp; + if (bp->b_actf == NULL) + sc->sc_buf_queue.b_actb = &bp->b_actf; mtx_leave(&sc->sc_queue_mtx); } diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 08a398c319c..59ef8378445 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.177 2010/01/11 00:14:52 beck Exp $ */ +/* $OpenBSD: sd.c,v 1.178 2010/01/11 00:44:40 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -600,6 +600,8 @@ sd_buf_dequeue(struct sd_softc *sc) bp = sc->sc_buf_queue.b_actf; if (bp != NULL) sc->sc_buf_queue.b_actf = bp->b_actf; + if (sc->sc_buf_queue.b_actf == NULL) + sc->sc_buf_queue.b_actb = &sc->sc_buf_queue.b_actf; mtx_leave(&sc->sc_buf_mtx); return (bp); @@ -611,6 +613,8 @@ sd_buf_requeue(struct sd_softc *sc, struct buf *bp) mtx_enter(&sc->sc_buf_mtx); bp->b_actf = sc->sc_buf_queue.b_actf; sc->sc_buf_queue.b_actf = bp; + if (bp->b_actf == NULL) + sc->sc_buf_queue.b_actb = &bp->b_actf; mtx_leave(&sc->sc_buf_mtx); } |