If target is turned off prior to postcopy finished, target crashes
because busy bitmaps are found at shutdown.
Canceling incoming migration helps, as it removes all unfinished (and
therefore busy) bitmaps.
Similarly on source we crash in bdrv_close_all which asserts that all
bdrv states are removed, because bdrv states involved into dirty bitmap
migration are referenced by it. So, we need to cancel outgoing
migration as well.
Signed-off-by: Vladimir Sementsov-Ogievskiy <firstname.lastname@example.org>
Reviewed-by: Andrey Shinkevich <email@example.com>
migration/migration.h | 2 ++
migration/block-dirty-bitmap.c | 16 ++++++++++++++++
migration/migration.c | 13 +++++++++++++
3 files changed, 31 insertions(+)
diff --git a/migration/migration.h b/migration/migration.h
index ab20c756f5..6c6a931d0d 100644
@@ -335,6 +335,8 @@ void migrate_send_rp_recv_bitmap(MigrationIncomingState
void migrate_send_rp_resume_ack(MigrationIncomingState *mis, uint32_t value);
void migrate_add_address(SocketAddress *address);
int foreach_not_ignored_block(RAMBlockIterFunc func, void *opaque);
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index c24d4614bf..a198ec7278 100644
@@ -657,6 +657,22 @@ static void cancel_incoming_locked(DBMLoadState *s)
s->bitmaps = NULL;
+ DBMLoadState *s = &dbm_state.load;
static void dirty_bitmap_load_complete(QEMUFile *f, DBMLoadState *s)
diff --git a/migration/migration.c b/migration/migration.c
index 1c61428988..8fe36339db 100644
@@ -188,6 +188,19 @@ void migration_shutdown(void)
+ * Cancel outgoing migration of dirty bitmaps. It should
+ * at least unref used block nodes.
+ * Cancel incoming migration of dirty bitmaps. Dirty bitmaps
+ * are non-critical data, and their loss never considered as
+ * something serious.