[Qemu-devel] [PULL 01/27] mirror: Release the dirty bitmap if mirror_start_job() fails

Kevin Wolf posted 27 patches 6 years, 2 months ago
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Jeff Cody <jcody@redhat.com>, Thomas Huth <thuth@redhat.com>, Stefan Weil <sw@weilnetz.de>, Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Fam Zheng <fam@euphon.net>, Markus Armbruster <armbru@redhat.com>, Cleber Rosa <crosa@redhat.com>, Eric Blake <eblake@redhat.com>, Ari Sundholm <ari@tuxera.com>, Max Reitz <mreitz@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Ben Warren <ben@skyportsystems.com>, Eduardo Habkost <ehabkost@redhat.com>
There is a newer version of this series
[Qemu-devel] [PULL 01/27] mirror: Release the dirty bitmap if mirror_start_job() fails
Posted by Kevin Wolf 6 years, 2 months ago
From: Alberto Garcia <berto@igalia.com>

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>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/mirror.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/mirror.c b/block/mirror.c
index 24ede6fdaa..4cf1c088c0 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);
     }
 
-- 
2.20.1