summaryrefslogtreecommitdiffstats
path: root/sys/dev/vinum
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>2000-12-20 05:18:09 +0000
committergrog <grog@FreeBSD.org>2000-12-20 05:18:09 +0000
commit525ccd86484fa3d8d0b02439cdda753268042a64 (patch)
tree110545ced1d30946ae3189080eb76bb0144649d8 /sys/dev/vinum
parent8b040789d7dcab9c7a9d9b15df6e7d8713e651f9 (diff)
downloadFreeBSD-src-525ccd86484fa3d8d0b02439cdda753268042a64.zip
FreeBSD-src-525ccd86484fa3d8d0b02439cdda753268042a64.tar.gz
build_rq_buffer: Note which buffer headers we lock.
sdio: Unlock the buffer if we fail. Submitted by: tegge
Diffstat (limited to 'sys/dev/vinum')
-rw-r--r--sys/dev/vinum/vinumrequest.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/vinum/vinumrequest.c b/sys/dev/vinum/vinumrequest.c
index 60b8054..35abf37 100644
--- a/sys/dev/vinum/vinumrequest.c
+++ b/sys/dev/vinum/vinumrequest.c
@@ -806,8 +806,14 @@ build_rq_buffer(struct rqelement *rqe, struct plex *plex)
bp->b_flags = ubp->b_flags & (B_NOCACHE | B_ASYNC);
bp->b_io.bio_flags = ubp->b_io.bio_flags & BIO_ORDERED;
bp->b_iocmd = ubp->b_iocmd;
+#ifdef VINUMDEBUG
+ if (rqe->flags & XFR_BUFLOCKED) /* paranoia */
+ panic("build_rq_buffer: rqe already locked"); /* XXX remove this when we're sure */
+#endif
BUF_LOCKINIT(bp); /* get a lock for the buffer */
BUF_LOCK(bp, LK_EXCLUSIVE); /* and lock it */
+ BUF_KERNPROC(bp);
+ rqe->flags |= XFR_BUFLOCKED;
bp->b_iodone = complete_rqe;
/*
* You'd think that we wouldn't need to even
@@ -942,6 +948,7 @@ sdio(struct buf *bp)
sbp->b.b_iodone = sdio_done; /* come here on completion */
BUF_LOCKINIT(&sbp->b); /* get a lock for the buffer */
BUF_LOCK(&sbp->b, LK_EXCLUSIVE); /* and lock it */
+ BUF_KERNPROC(&sbp->b);
sbp->bp = bp; /* note the address of the original header */
sbp->sdno = sd->sdno; /* note for statistics */
sbp->driveno = sd->driveno;
@@ -951,6 +958,8 @@ sdio(struct buf *bp)
if (sbp->b.b_bcount <= 0) { /* nothing to transfer */
bp->b_resid = bp->b_bcount; /* nothing transferred */
bufdone(bp);
+ BUF_UNLOCK(&sbp->b);
+ BUF_LOCKFREE(&sbp->b);
Free(sbp);
return;
}
OpenPOWER on IntegriCloud