From de6f1c7c6ca33431773fd28d75156afd5c385d51 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Wed, 9 Aug 2006 09:41:53 +0000 Subject: [PATCH] Not only a request from us can be passed to g_{mirror,raid3}_worker() function, but also a request to us, in which case checking bio_cflags is wrong, because the class above us is controling it, not we. MFC after: 1 week --- sys/geom/mirror/g_mirror.c | 17 ++++++++++++----- sys/geom/raid3/g_raid3.c | 16 +++++++++++----- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 8ddb529bc3d7..56e52bb94d7f 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -1813,12 +1813,19 @@ g_mirror_worker(void *arg) bioq_remove(&sc->sc_queue, bp); mtx_unlock(&sc->sc_queue_mtx); - if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_REGULAR) != 0) - g_mirror_regular_request(bp); - else if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0) - g_mirror_sync_request(bp); - else + if (bp->bio_to != sc->sc_provider) { + if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_REGULAR) != 0) + g_mirror_regular_request(bp); + else if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0) + g_mirror_sync_request(bp); + else { + KASSERT(0, + ("Invalid request cflags=0x%hhx to=%s.", + bp->bio_cflags, bp->bio_to->name)); + } + } else { g_mirror_register_request(bp); + } G_MIRROR_DEBUG(5, "%s: I'm here 9.", __func__); } } diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 89f56864d333..177148bde75d 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -2061,11 +2061,17 @@ g_raid3_worker(void *arg) bioq_remove(&sc->sc_queue, bp); mtx_unlock(&sc->sc_queue_mtx); - if ((bp->bio_cflags & G_RAID3_BIO_CFLAG_REGULAR) != 0) - g_raid3_regular_request(bp); - else if ((bp->bio_cflags & G_RAID3_BIO_CFLAG_SYNC) != 0) - g_raid3_sync_request(bp); - else if (g_raid3_register_request(bp) != 0) { + if (bp->bio_to != sc->sc_provider) { + if ((bp->bio_cflags & G_RAID3_BIO_CFLAG_REGULAR) != 0) + g_raid3_regular_request(bp); + else if ((bp->bio_cflags & G_RAID3_BIO_CFLAG_SYNC) != 0) + g_raid3_sync_request(bp); + else { + KASSERT(0, + ("Invalid request cflags=0x%hhx to=%s.", + bp->bio_cflags, bp->bio_to->name)); + } + } else if (g_raid3_register_request(bp) != 0) { mtx_lock(&sc->sc_queue_mtx); bioq_insert_head(&sc->sc_queue, bp); /*