summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2000-11-26 16:16:04 +0000
committerad <ad@NetBSD.org>2000-11-26 16:16:04 +0000
commitee170a55280704e4079bf767997565dce90ec83b (patch)
treec4d535d71b594ac8c9aca50316950bf094cdc289 /sys/dev
parent63d8906bac523102aaf32c4955264014413d13ab (diff)
Avoid a possible stall.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/lsu.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/lsu.c b/sys/dev/lsu.c
index 0daf588e8ac..810f8e12d0e 100644
--- a/sys/dev/lsu.c
+++ b/sys/dev/lsu.c
@@ -69,7 +69,7 @@ static void lsugetdisklabel(struct lsu_softc *);
static int lsulock(struct lsu_softc *);
static void lsuminphys(struct buf *bp);
static void lsushutdown(void *);
-static void lsustart(struct lsu_softc *, struct buf *);
+static int lsustart(struct lsu_softc *, struct buf *);
static void lsuunlock(struct lsu_softc *);
extern struct cfdriver lsu_cd;
@@ -295,7 +295,7 @@ lsustrategy(struct buf *bp)
lsustart(sc, bp);
}
-static void
+static int
lsustart(struct lsu_softc *sc, struct buf *bp)
{
struct disklabel *lp;
@@ -311,6 +311,7 @@ lsustart(struct lsu_softc *sc, struct buf *bp)
if ((bp->b_bcount % lp->d_secsize) != 0 || bp->b_blkno < 0) {
bp->b_flags |= B_ERROR;
biodone(bp);
+ return (-1);
}
/*
@@ -319,7 +320,7 @@ lsustart(struct lsu_softc *sc, struct buf *bp)
if (bp->b_bcount == 0) {
bp->b_resid = bp->b_bcount;
biodone(bp);
- return;
+ return (-1);
}
/*
@@ -331,7 +332,7 @@ lsustart(struct lsu_softc *sc, struct buf *bp)
(sc->sc_flags & (LSUF_WLABEL | LSUF_LABELLING)) != 0) <= 0) {
bp->b_resid = bp->b_bcount;
biodone(bp);
- return;
+ return (-1);
}
/*
@@ -359,6 +360,8 @@ lsustart(struct lsu_softc *sc, struct buf *bp)
lsudone(sc, bp);
splx(s);
}
+
+ return (0);
}
void
@@ -377,9 +380,10 @@ lsudone(struct lsu_softc *sc, struct buf *bp)
biodone(bp);
sc->sc_queuecnt--;
- if ((bp = BUFQ_FIRST(&sc->sc_bufq)) != NULL) {
+ while ((bp = BUFQ_FIRST(&sc->sc_bufq)) != NULL) {
BUFQ_REMOVE(&sc->sc_bufq, bp);
- lsustart(sc, bp);
+ if (!lsustart(sc, bp))
+ break;
}
}