aboutsummaryrefslogtreecommitdiff
path: root/block-migration.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-04-25 12:22:37 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-04-25 12:22:37 +0100
commit7931b05987564b07ada5a4467d8e78a786a3e7d4 (patch)
treec3cb42df6e17e3985c055637700dea279c5b7656 /block-migration.c
parent0e96643c98eb22a5f2e11ac500852133032d38e4 (diff)
parent370e681629da587af7592a7b83ebc7ec4955461e (diff)
downloadqemu-7931b05987564b07ada5a4467d8e78a786a3e7d4.zip
qemu-7931b05987564b07ada5a4467d8e78a786a3e7d4.tar.gz
qemu-7931b05987564b07ada5a4467d8e78a786a3e7d4.tar.bz2
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block patches # gpg: Signature made Wed 23 Apr 2014 11:02:29 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: block/cloop: use PRIu32 format specifier for uint32_t vmdk: Fix "%x" to PRIx32 in format strings for cid qemu-img: Improve error messages qemu-iotests: Check common namespace for id and node-name block: Catch duplicate IDs in bdrv_new() qemu-img: Avoid duplicate block device IDs block: Add errp to bdrv_new() convert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create() block: Remove -errno return value from bdrv_assign_node_name curl: Replaced old error handling with error reporting API. block: Handle error of bdrv_getlength in bdrv_create_dirty_bitmap vmdk: Fix %d and %lld to PRI* in format strings block: Check bdrv_getlength() return value in bdrv_make_zero() block: Catch integer overflow in bdrv_rw_co() block: Limit size to INT_MAX in bdrv_check_byte_request() block: Fix nb_sectors check in bdrv_check_byte_request() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block-migration.c')
-rw-r--r--block-migration.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/block-migration.c b/block-migration.c
index 897fdba..56951e0 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -310,13 +310,28 @@ static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds)
/* Called with iothread lock taken. */
-static void set_dirty_tracking(void)
+static int set_dirty_tracking(void)
{
BlkMigDevState *bmds;
+ int ret;
QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
- bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE);
+ bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE,
+ NULL);
+ if (!bmds->dirty_bitmap) {
+ ret = -errno;
+ goto fail;
+ }
}
+ return 0;
+
+fail:
+ QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
+ if (bmds->dirty_bitmap) {
+ bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap);
+ }
+ }
+ return ret;
}
static void unset_dirty_tracking(void)
@@ -611,10 +626,17 @@ static int block_save_setup(QEMUFile *f, void *opaque)
block_mig_state.submitted, block_mig_state.transferred);
qemu_mutex_lock_iothread();
- init_blk_migration(f);
/* start track dirty blocks */
- set_dirty_tracking();
+ ret = set_dirty_tracking();
+
+ if (ret) {
+ qemu_mutex_unlock_iothread();
+ return ret;
+ }
+
+ init_blk_migration(f);
+
qemu_mutex_unlock_iothread();
ret = flush_blks(f);