summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-11-09 23:04:45 +0000
committerpjd <pjd@FreeBSD.org>2004-11-09 23:04:45 +0000
commit5cac5220465dd3c592edd4fbe3ccc443a89b1221 (patch)
tree4c7c26474c0ab6e36350a38534d7049ecb957982 /sys/geom
parent6f9f259ced1a0072519e6a6859d10b11a0f1cf30 (diff)
downloadFreeBSD-src-5cac5220465dd3c592edd4fbe3ccc443a89b1221.zip
FreeBSD-src-5cac5220465dd3c592edd4fbe3ccc443a89b1221.tar.gz
For BIO_READ check if provider is open for reading and for BIO_WRITE,
check if provider is open for writing. This fixes panic when device is open only for writing and we send write request.
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/raid3/g_raid3.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c
index f4d6d89..36f3e20 100644
--- a/sys/geom/raid3/g_raid3.c
+++ b/sys/geom/raid3/g_raid3.c
@@ -1009,9 +1009,17 @@ g_raid3_scatter(struct bio *pbp)
cp = disk->d_consumer;
cbp->bio_to = cp->provider;
G_RAID3_LOGREQ(3, cbp, "Sending request.");
- KASSERT(cp->acr > 0 && cp->ace > 0,
- ("Consumer %s not opened (r%dw%de%d).", cp->provider->name,
- cp->acr, cp->acw, cp->ace));
+#ifdef INVARIANTS
+ if (cbp->bio_cmd == BIO_READ) {
+ KASSERT(cp->acr > 0 && cp->ace > 0,
+ ("Consumer %s not opened (r%dw%de%d).",
+ cp->provider->name, cp->acr, cp->acw, cp->ace));
+ } else if (cbp->bio_cmd == BIO_WRITE) {
+ KASSERT(cp->acw > 0 && cp->ace > 0,
+ ("Consumer %s not opened (r%dw%de%d).",
+ cp->provider->name, cp->acr, cp->acw, cp->ace));
+ }
+#endif
cp->index++;
g_io_request(cbp, cp);
}
OpenPOWER on IntegriCloud