From: Cédric Le Goater <[email protected]> The block .save_setup() handler calls a helper routine init_blk_migration() which builds a list of block devices to take into account for migration. When one device is found to be empty (sectors == 0), the loop exits and all the remaining devices are ignored. This is a regression introduced when bdrv_iterate() was removed.
Change that by skipping only empty devices. Cc: Markus Armbruster <[email protected]> Cc: qemu-stable <[email protected]> Suggested-by: Kevin Wolf <[email protected]> Fixes: fea68bb6e9fa ("block: Eliminate bdrv_iterate(), use bdrv_next()") Signed-off-by: Cédric Le Goater <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Kevin Wolf <[email protected]> Link: https://lore.kernel.org/r/[email protected] [peterx: fix "Suggested-by:"] Signed-off-by: Peter Xu <[email protected]> (cherry picked from commit 2e128776dc56f502c2ee41750afe83938f389528) Signed-off-by: Michael Tokarev <[email protected]> diff --git a/migration/block.c b/migration/block.c index a15f9bddcb..710ef6f490 100644 --- a/migration/block.c +++ b/migration/block.c @@ -409,7 +409,10 @@ static int init_blk_migration(QEMUFile *f) } sectors = bdrv_nb_sectors(bs); - if (sectors <= 0) { + if (sectors == 0) { + continue; + } + if (sectors < 0) { ret = sectors; bdrv_next_cleanup(&it); goto out; -- 2.39.2
