diff mbox series

[2/4] block: block_dirty_bitmap_merge(): fix error path

Message ID 20220215175310.68058-3-vsementsov@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series block/dirty-bitmaps: fix and improve bitmap merge | expand

Commit Message

Vladimir Sementsov-Ogievskiy Feb. 15, 2022, 5:53 p.m. UTC
At the end we ignore failure of bdrv_merge_dirty_bitmap() and report
success. And still set errp. That's wrong.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block/monitor/bitmap-qmp-cmds.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Nikta Lapshin Feb. 19, 2022, 10:26 a.m. UTC | #1
On 2/15/22 20:53, Vladimir Sementsov-Ogievskiy wrote:

Reviewed-by: Nikita Lapshin<nikita.lapshin@virtuozzo.com>

> At the end we ignore failure of bdrv_merge_dirty_bitmap() and report
> success. And still set errp. That's wrong.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy<vsementsov@virtuozzo.com>
> ---
>   block/monitor/bitmap-qmp-cmds.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/block/monitor/bitmap-qmp-cmds.c b/block/monitor/bitmap-qmp-cmds.c
> index 83970b22fa..a94aaa9fb3 100644
> --- a/block/monitor/bitmap-qmp-cmds.c
> +++ b/block/monitor/bitmap-qmp-cmds.c
> @@ -303,7 +303,10 @@ BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
>       }
>   
>       /* Merge into dst; dst is unchanged on failure. */
> -    bdrv_merge_dirty_bitmap(dst, anon, backup, errp);
> +    if (!bdrv_merge_dirty_bitmap(dst, anon, backup, errp)) {
> +        dst = NULL;
> +        goto out;
> +    }
>   
>    out:
>       bdrv_release_dirty_bitmap(anon);
diff mbox series

Patch

diff --git a/block/monitor/bitmap-qmp-cmds.c b/block/monitor/bitmap-qmp-cmds.c
index 83970b22fa..a94aaa9fb3 100644
--- a/block/monitor/bitmap-qmp-cmds.c
+++ b/block/monitor/bitmap-qmp-cmds.c
@@ -303,7 +303,10 @@  BdrvDirtyBitmap *block_dirty_bitmap_merge(const char *node, const char *target,
     }
 
     /* Merge into dst; dst is unchanged on failure. */
-    bdrv_merge_dirty_bitmap(dst, anon, backup, errp);
+    if (!bdrv_merge_dirty_bitmap(dst, anon, backup, errp)) {
+        dst = NULL;
+        goto out;
+    }
 
  out:
     bdrv_release_dirty_bitmap(anon);