summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-11-01 15:32:12 +0000
committerphk <phk@FreeBSD.org>2002-11-01 15:32:12 +0000
commit85539f2f6cf7db5cdb12846675492a4ab0bfeae0 (patch)
tree300c1a2d2779db4dce526e0a803ee5abd7d9f636
parentb7e16f352965af4600c8c6494610b0a649a404d1 (diff)
downloadFreeBSD-src-85539f2f6cf7db5cdb12846675492a4ab0bfeae0.zip
FreeBSD-src-85539f2f6cf7db5cdb12846675492a4ab0bfeae0.tar.gz
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.
-rw-r--r--sys/fs/specfs/spec_vnops.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index ed5c2bc..5700f10 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 &&
OpenPOWER on IntegriCloud