diff mbox series

[1/2] mirror: Release the dirty bitmap if mirror_start_job() fails

Message ID 7562baab810142c29e5a1afb50c65f98bbd98833.1542898669.git.berto@igalia.com (mailing list archive)
State New, archived
Headers show
Series Minor fixes for the mirror block job | expand

Commit Message

Alberto Garcia Nov. 22, 2018, 3 p.m. UTC
At the moment I don't see how to make this function fail after the
dirty bitmap has been created, but if that was possible then we would
hit the assert(QLIST_EMPTY(&bs->dirty_bitmaps)) in bdrv_close().

Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 block/mirror.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/block/mirror.c b/block/mirror.c
index 56d9ef7474..664c452f71 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1649,6 +1649,9 @@  fail:
         g_free(s->replaces);
         blk_unref(s->target);
         bs_opaque->job = NULL;
+        if (s->dirty_bitmap) {
+            bdrv_release_dirty_bitmap(bs, s->dirty_bitmap);
+        }
         job_early_fail(&s->common.job);
     }