[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/12] blockdev-backup: Don't move target AioContext
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 03/12] blockdev-backup: Don't move target AioContext if it's attached |
Date: |
Tue, 7 Jun 2016 15:26:16 +0100 |
From: Fam Zheng <address@hidden>
If the BDS is attached, it will want to stay on the AioContext where its
BlockBackend is. Don't call bdrv_set_aio_context in this case.
Signed-off-by: Fam Zheng <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
blockdev.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index ea7f397..6ccb8e1 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3371,7 +3371,17 @@ void do_blockdev_backup(const char *device, const char
*target,
goto out;
}
- bdrv_set_aio_context(target_bs, aio_context);
+ if (bdrv_get_aio_context(target_bs) != aio_context) {
+ if (!bdrv_has_blk(target_bs)) {
+ /* The target BDS is not attached, we can safely move it to another
+ * AioContext. */
+ bdrv_set_aio_context(target_bs, aio_context);
+ } else {
+ error_setg(errp, "Target is attached to a different thread from "
+ "source.");
+ goto out;
+ }
+ }
backup_start(bs, target_bs, speed, sync, NULL, on_source_error,
on_target_error, block_job_cb, bs, txn, &local_err);
if (local_err != NULL) {
--
2.5.5
- [Qemu-devel] [PULL 00/12] Block patches, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 03/12] blockdev-backup: Don't move target AioContext if it's attached,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 01/12] tests: avoid coroutine pool test crash, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 02/12] blockdev-backup: Use bdrv_lookup_bs on target, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 04/12] virtio-blk: Remove op blocker for dataplane, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 05/12] virtio-scsi: Remove op blocker for dataplane, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 07/12] block/io: Remove unused bdrv_aio_write_zeroes(), Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 08/12] iostatus: fix comments for block_job_iostatus_reset, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 06/12] virtio: drop duplicate virtio_queue_get_id() function, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 11/12] block: Drop bdrv_ioctl_bh_cb, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 09/12] block/io: optimize bdrv_co_pwritev for small requests, Stefan Hajnoczi, 2016/06/07
- [Qemu-devel] [PULL 10/12] block: Move BlockRequest type to io.c, Stefan Hajnoczi, 2016/06/07