[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 3/8] migration/block: Clean up BBs in block_save_comp
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 3/8] migration/block: Clean up BBs in block_save_complete() |
Date: |
Wed, 7 Jun 2017 19:50:14 +0200 |
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 <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
---
migration/block.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/migration/block.c b/migration/block.c
index 4d8c2e9..114cedb 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -674,16 +674,14 @@ static int64_t get_remaining_dirty(void)
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;
- BlkMigBlock *blk;
AioContext *ctx;
- bdrv_drain_all();
-
unset_dirty_tracking();
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);
}
+}
+
+/* Called with iothread lock taken. */
+static void block_migration_cleanup(void *opaque)
+{
+ BlkMigBlock *blk;
+
+ bdrv_drain_all();
+
+ block_migration_cleanup_bmds();
blk_mig_lock();
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);
+ /* Make sure that our BlockBackends are gone, so that the block driver
+ * nodes can be inactivated. */
+ block_migration_cleanup_bmds();
+
return 0;
}
--
1.8.3.1
- [Qemu-block] [PULL 0/8] Block layer patches, Kevin Wolf, 2017/06/07
- [Qemu-block] [PULL 1/8] block: Fix anonymous BBs in blk_root_inactivate(), Kevin Wolf, 2017/06/07
- [Qemu-block] [PULL 2/8] migration: Inactivate images after .save_live_complete_precopy(), Kevin Wolf, 2017/06/07
- [Qemu-block] [PULL 3/8] migration/block: Clean up BBs in block_save_complete(),
Kevin Wolf <=
- [Qemu-block] [PULL 4/8] qemu-iotests: Block migration test, Kevin Wolf, 2017/06/07
- [Qemu-block] [PULL 5/8] commit: Fix use after free in completion, Kevin Wolf, 2017/06/07
- [Qemu-block] [PULL 7/8] block/qcow.c: Fix memory leak in qcow_create(), Kevin Wolf, 2017/06/07
- [Qemu-block] [PULL 6/8] qemu-iotests: Test automatic commit job cancel on hot unplug, Kevin Wolf, 2017/06/07
- [Qemu-block] [PULL 8/8] block: fix external snapshot abort permission error, Kevin Wolf, 2017/06/07
- Re: [Qemu-block] [Qemu-devel] [PULL 0/8] Block layer patches, Peter Maydell, 2017/06/12