aboutsummaryrefslogtreecommitdiff
path: root/migration/block.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-06-05 14:39:04 +0200
committerFam Zheng <famz@redhat.com>2017-06-16 07:55:00 +0800
commitc0bad49946287ef218e871608b753b9991f6e54c (patch)
tree4fd4c9821a88147f939e5d1acc29a30b952ec568 /migration/block.c
parent2119882c7eb7e2c612b24fc0c8d86f5887d6f1c3 (diff)
downloadqemu-c0bad49946287ef218e871608b753b9991f6e54c.zip
qemu-c0bad49946287ef218e871608b753b9991f6e54c.tar.gz
qemu-c0bad49946287ef218e871608b753b9991f6e54c.tar.bz2
migration/block: reset dirty bitmap before reading
Any data that is returned by read may be stale already, the bitmap has to be cleared before issuing the read. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20170605123908.18777-16-pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'migration/block.c')
-rw-r--r--migration/block.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/migration/block.c b/migration/block.c
index 9e20926..423877b 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -532,6 +532,8 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds,
} else {
nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK;
}
+ bdrv_reset_dirty_bitmap(bmds->dirty_bitmap, sector, nr_sectors);
+
blk = g_new(BlkMigBlock, 1);
blk->buf = g_malloc(BLOCK_SIZE);
blk->bmds = bmds;
@@ -564,7 +566,6 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds,
g_free(blk);
}
- bdrv_reset_dirty_bitmap(bmds->dirty_bitmap, sector, nr_sectors);
sector += nr_sectors;
bmds->cur_dirty = sector;