diff mbox

[15/18] migration/block: reset dirty bitmap before reading

Message ID 20170511144208.24075-16-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini May 11, 2017, 2:42 p.m. UTC
Any data that is returned by read may be stale already, the bitmap
has to be cleared before issuing the read.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
        v1->v2: new

 migration/block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stefan Hajnoczi May 16, 2017, 3:03 p.m. UTC | #1
On Thu, May 11, 2017 at 04:42:05PM +0200, Paolo Bonzini wrote:
> Any data that is returned by read may be stale already, the bitmap
> has to be cleared before issuing the read.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>         v1->v2: new
> 
>  migration/block.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox

Patch

diff --git a/migration/block.c b/migration/block.c
index e4b3212ba7..79adab88cf 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -537,6 +537,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;
@@ -569,7 +571,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;