diff options
author | Fam Zheng <famz@redhat.com> | 2016-05-23 10:19:36 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2016-06-07 14:40:50 +0100 |
commit | efd7556708bdfb61dab259e08bd71fbe5680ddcd (patch) | |
tree | 0ec89744ce10b269871e4d6df58fe83388a169ae | |
parent | 0d97891312d24891868e341674541f4147c7faf4 (diff) | |
download | qemu-efd7556708bdfb61dab259e08bd71fbe5680ddcd.zip qemu-efd7556708bdfb61dab259e08bd71fbe5680ddcd.tar.gz qemu-efd7556708bdfb61dab259e08bd71fbe5680ddcd.tar.bz2 |
blockdev-backup: Don't move target AioContext if it's attached
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 <famz@redhat.com>
Message-id: 1463969978-24970-3-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r-- | blockdev.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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) { |