migration/block-dirty-bitmap: fix add_bitmaps_to_list
PATCH 1/1 migration/block-dirty-bitmap: fix add_bitmaps_to_list
We shouldn't fail, if found unnamed bitmap in a unnamed node or node with auto-generated node name, as bitmap migration ignores such bitmaps at all.
--- migration/block-dirty-bitmap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
migration/block-dirty-bitmap.c +5 -1
@@ -274,7 +274,11 @@ static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name)DirtyBitmapMigBitmapState *dbms;Error *local_err =NULL ; - bitmap =bdrv_dirty_bitmap_first (bs); + FOR_EACH_DIRTY_BITMAP(bs, bitmap) { +if (bdrv_dirty_bitmap_name (bitmap)) { +break ; + } + }if (!bitmap) {return 0 ; }
Signature · 1 line
2.18.0
Quoted 1 line · Vladimir Sementsov-Ogievskiy
We shouldn't fail, if found unnamed bitmap in a unnamed node or node
We shouldn't fail when finding an unnamed
Quoted 2 lines
with auto-generated node name, as bitmap migration ignores such bitmaps at all.
such bitmaps in the first place.
Quoted 8 lines
Fixes 82640edb88faaFixes 4ff5cc121b089Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- migration/block-dirty-bitmap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Will queue through the bitmaps tree.
Is this easy enough to reproduce that it would be worth having iotest coverage?
Quoted 18 lines
migration/block-dirty-bitmap.c +5
-1@@ -274,7 +274,11 @@ static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name)DirtyBitmapMigBitmapState *dbms;Error *local_err =NULL ; - bitmap =bdrv_dirty_bitmap_first (bs); + FOR_EACH_DIRTY_BITMAP(bs, bitmap) { +if (bdrv_dirty_bitmap_name (bitmap)) { +break ; + } + }if (!bitmap) {return 0 ; }
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 19 lines · Eric Blake
Quoted 1 line · Vladimir Sementsov-Ogievskiy
We shouldn't fail, if found unnamed bitmap in a unnamed node or node
We shouldn't fail when finding an unnamed
Quoted 2 lines
with auto-generated node name, as bitmap migration ignores such bitmaps at all.
such bitmaps in the first place.
Quoted 8 lines
Fixes 82640edb88faaFixes 4ff5cc121b089Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>---
migration/block-dirty-bitmap.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)
Quoted 5 lines
Reviewed-by Eric Blake <[email protected]>Will queue through the bitmaps tree.
Is this easy enough to reproduce that it would be worth having iotest coverage?
I don't think it worth it. This all is so bad, I only hope for the future of explicit mapping.
This patch just fixes wrong code. Actually, today I've committed to downstream also a change, which when see auto-generated node-name a few lines above just returns 0 instead of an error, otherwise, in some specific case, bitmaps which were in backing files break migrations (and when skipped, they migrate through storage, as our specific case is storage migration).. Don't know, how much it applies to upstream.
I've already said about my idea of "lazy" disabled bitmap: we shouldn't load them all on start, but on demand. Actually same thing may be said about bitmaps in read-only nodes. And of course migrating bitmaps from r-o backing chain, when it is shared-migration is nonsense.
Quoted 10 lines
Quoted 10 lines
migration/block-dirty-bitmap.c +1
-1@@ -274,7 +274,11 @@ static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) DirtyBitmapMigBitmapState *dbms; Error *local_err = NULL; - bitmap = bdrv_dirty_bitmap_first(bs); + FOR_EACH_DIRTY_BITMAP(bs, bitmap) {
Quoted 9 lines
migration/block-dirty-bitmap.c static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name) · line 284
Quoted 8 lines
migration/block-dirty-bitmap.c +4
-0+ if (bdrv_dirty_bitmap_name(bitmap)) { + break; + } + } if (!bitmap) { return 0; }
Here is my today's downstream fix:
migration/block-dirty-bitmap.c +6 -4
@@ -312,10 +312,12 @@ static int add_bitmaps_to_list(DBMSaveState *s, }if (bs_name[0 ] =='#' ) { -error_report ("Found bitmap '%s' in a node with auto-generated " -"name: %s. It can't be migrated" , -bdrv_dirty_bitmap_name (bitmap), bs_name); -return -1 ; +/* +* Reporting error here breaks shared migration of dispatcher-created +* bitmaps. In u13 we just ignored them (ignored all bitmaps in backing +* files). So, just ignore the node. +*/ +return 0 ; }for ( ; bitmap; bitmap =bdrv_dirty_bitmap_next (bs, bitmap)) {
I can send a patch, if you think it worth it. For me it seems too hacky and too specific. With this change, bitmaps in backing chain can be migrated though shared-storage when dirty-bitmaps capability is enabled.
(for clarity: u13 didn't have patch
592203e7cfbd1a "migration/dirty-bitmaps: change bitmap enumeration method", and in u14 we've backported it)
Signature · 2 lines
Best regards, Vladimir