From: Cédric Le Goater <c...@redhat.com> 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 <arm...@redhat.com> Cc: qemu-stable <qemu-sta...@nongnu.org> Suggested-by: Kevin Wolf <kw...@redhat.com> Fixes: fea68bb6e9fa ("block: Eliminate bdrv_iterate(), use bdrv_next()") Signed-off-by: Cédric Le Goater <c...@redhat.com> Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com> Reviewed-by: Kevin Wolf <kw...@redhat.com> Link: https://lore.kernel.org/r/20240312120431.550054-1-...@redhat.com [peterx: fix "Suggested-by:"] Signed-off-by: Peter Xu <pet...@redhat.com> --- migration/block.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/migration/block.c b/migration/block.c index 8c6ebafacc..2b9054889a 100644 --- a/migration/block.c +++ b/migration/block.c @@ -402,7 +402,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.44.0