From 45c589005480d040752195b359fd3eb888b49bec Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 1 Nov 2002 15:32:12 +0000 Subject: [PATCH] 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. --- sys/fs/specfs/spec_vnops.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index ed5c2bc17365..5700f10bf7e2 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -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 &&