[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v2 2/4] blockdev-backup: Don't move target AioContex
From: |
Fam Zheng |
Subject: |
[Qemu-block] [PATCH v2 2/4] blockdev-backup: Don't move target AioContext if it's attached |
Date: |
Mon, 23 May 2016 10:19:36 +0800 |
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>
---
blockdev.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index 026ead0..85eb7d7 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3382,8 +3382,18 @@ void do_blockdev_backup(const char *device, const char
*target,
goto out;
}
+ 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;
+ }
+ }
bdrv_ref(target_bs);
- bdrv_set_aio_context(target_bs, aio_context);
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.8.2
- [Qemu-block] [PATCH v2 0/4] Drop virtio-{blk,scsi} op blockers, Fam Zheng, 2016/05/22
- [Qemu-block] [PATCH v2 1/4] blockdev-backup: Use bdrv_lookup_bs on target, Fam Zheng, 2016/05/22
- [Qemu-block] [PATCH v2 2/4] blockdev-backup: Don't move target AioContext if it's attached,
Fam Zheng <=
- [Qemu-block] [PATCH v2 3/4] virtio-blk: Remove op blocker for dataplane, Fam Zheng, 2016/05/22
- [Qemu-block] [PATCH v2 4/4] virtio-scsi: Remove op blocker for dataplane, Fam Zheng, 2016/05/22
- Re: [Qemu-block] [Qemu-devel] [PATCH v2 0/4] Drop virtio-{blk, scsi} op blockers, Fam Zheng, 2016/05/25
- Re: [Qemu-block] [PATCH v2 0/4] Drop virtio-{blk,scsi} op blockers, Stefan Hajnoczi, 2016/05/27