Put a KASSERT in specfs::strategy() to check that the incoming buffer

has a valid b_iocmd.  Valid is any one of BIO_{READ,WRITE,DELETE}.

I have seen at least one case where the bio_cmd field was zero once the
request made it into GEOM.  Putting the KASSERT here allows us to spot
the culprit in the backtrace.
This commit is contained in:
Poul-Henning Kamp 2002-11-01 15:32:12 +00:00
parent 63ef2aa82d
commit 45c5890054

View File

@ -532,6 +532,14 @@ spec_strategy(ap)
struct cdevsw *dsw;
struct thread *td = curthread;
bp = ap->a_bp;
vp = ap->a_vp;
KASSERT(bp->b_iocmd == BIO_READ ||
bp->b_iocmd == BIO_WRITE ||
bp->b_iocmd == BIO_DELETE,
("Wrong b_iocmd buf=%p cmd=%d", bp, bp->b_iocmd));
/*
* Slow down disk requests for niced processes.
*/
@ -541,8 +549,6 @@ spec_strategy(ap)
PPAUSE | PCATCH | PDROP, "ioslow",
td->td_ksegrp->kg_nice);
}
bp = ap->a_bp;
vp = ap->a_vp;
if (bp->b_iocmd == BIO_WRITE) {
if ((bp->b_flags & B_VALIDSUSPWRT) == 0 &&
bp->b_vp != NULL && bp->b_vp->v_mount != NULL &&