diff options
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/io.c b/block/io.c index 76dfaf4250..dd6c74f62c 100644 --- a/block/io.c +++ b/block/io.c @@ -2080,6 +2080,11 @@ void bdrv_aio_cancel(BlockAIOCB *acb) if (acb->aiocb_info->get_aio_context) { aio_poll(acb->aiocb_info->get_aio_context(acb), true); } else if (acb->bs) { + /* qemu_aio_ref and qemu_aio_unref are not thread-safe, so + * assert that we're not using an I/O thread. Thread-safe + * code should use bdrv_aio_cancel_async exclusively. + */ + assert(bdrv_get_aio_context(acb->bs) == qemu_get_aio_context()); aio_poll(bdrv_get_aio_context(acb->bs), true); } else { abort(); |