diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2017-02-13 14:52:26 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2017-02-21 11:14:08 +0000 |
commit | e5c67ab552fb056827b5b40356c0ef235e975e7e (patch) | |
tree | 2e92976f6ed2d2c58cd6a0faee223fcdca08cc77 /block | |
parent | a9d9235567e7637d474fa9a52432c63c9feeed07 (diff) | |
download | qemu-e5c67ab552fb056827b5b40356c0ef235e975e7e.zip qemu-e5c67ab552fb056827b5b40356c0ef235e975e7e.tar.gz qemu-e5c67ab552fb056827b5b40356c0ef235e975e7e.tar.bz2 |
blkdebug: reschedule coroutine on the AioContext it is running on
Keep the coroutine on the same AioContext. Without this change,
there would be a race between yielding the coroutine and reentering it.
While the race cannot happen now, because the code only runs from a single
AioContext, this will change with multiqueue support in the block layer.
While doing the change, replace custom bottom half with aio_co_schedule.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170213135235.12274-10-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blkdebug.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/block/blkdebug.c b/block/blkdebug.c index acccf85..d8eee1b 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -405,12 +405,6 @@ out: return ret; } -static void error_callback_bh(void *opaque) -{ - Coroutine *co = opaque; - qemu_coroutine_enter(co); -} - static int inject_error(BlockDriverState *bs, BlkdebugRule *rule) { BDRVBlkdebugState *s = bs->opaque; @@ -423,8 +417,7 @@ static int inject_error(BlockDriverState *bs, BlkdebugRule *rule) } if (!immediately) { - aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), error_callback_bh, - qemu_coroutine_self()); + aio_co_schedule(qemu_get_current_aio_context(), qemu_coroutine_self()); qemu_coroutine_yield(); } |