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 /sys/scsi/sd.c | |
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@
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r-- | sys/scsi/sd.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); } |