mirror of https://gitee.com/openkylin/qemu.git
migration/block: Clean up BBs in block_save_complete()
We need to release any block migrations BlockBackends on the source before successfully completing the migration because otherwise inactivating the images will fail (inactivation only tolerates device BBs). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com>
This commit is contained in:
parent
f07fa4cbf0
commit
362fdf170c
|
@ -674,16 +674,14 @@ static int64_t get_remaining_dirty(void)
|
||||||
return dirty << BDRV_SECTOR_BITS;
|
return dirty << BDRV_SECTOR_BITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called with iothread lock taken. */
|
|
||||||
|
|
||||||
static void block_migration_cleanup(void *opaque)
|
|
||||||
|
/* Called with iothread lock taken. */
|
||||||
|
static void block_migration_cleanup_bmds(void)
|
||||||
{
|
{
|
||||||
BlkMigDevState *bmds;
|
BlkMigDevState *bmds;
|
||||||
BlkMigBlock *blk;
|
|
||||||
AioContext *ctx;
|
AioContext *ctx;
|
||||||
|
|
||||||
bdrv_drain_all();
|
|
||||||
|
|
||||||
unset_dirty_tracking();
|
unset_dirty_tracking();
|
||||||
|
|
||||||
while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
|
while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
|
||||||
|
@ -701,6 +699,16 @@ static void block_migration_cleanup(void *opaque)
|
||||||
g_free(bmds->aio_bitmap);
|
g_free(bmds->aio_bitmap);
|
||||||
g_free(bmds);
|
g_free(bmds);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Called with iothread lock taken. */
|
||||||
|
static void block_migration_cleanup(void *opaque)
|
||||||
|
{
|
||||||
|
BlkMigBlock *blk;
|
||||||
|
|
||||||
|
bdrv_drain_all();
|
||||||
|
|
||||||
|
block_migration_cleanup_bmds();
|
||||||
|
|
||||||
blk_mig_lock();
|
blk_mig_lock();
|
||||||
while ((blk = QSIMPLEQ_FIRST(&block_mig_state.blk_list)) != NULL) {
|
while ((blk = QSIMPLEQ_FIRST(&block_mig_state.blk_list)) != NULL) {
|
||||||
|
@ -844,6 +852,10 @@ static int block_save_complete(QEMUFile *f, void *opaque)
|
||||||
|
|
||||||
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
|
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
|
||||||
|
|
||||||
|
/* Make sure that our BlockBackends are gone, so that the block driver
|
||||||
|
* nodes can be inactivated. */
|
||||||
|
block_migration_cleanup_bmds();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue