diff options
-rw-r--r-- | qemu-img.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/qemu-img.c b/qemu-img.c index 7b9ba99f5d..5bb63c5e0c 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4646,6 +4646,7 @@ static int img_bitmap(int argc, char **argv) QSIMPLEQ_HEAD(, ImgBitmapAction) actions; ImgBitmapAction *act, *act_next; const char *op; + int inactivate_ret; QSIMPLEQ_INIT(&actions); @@ -4830,6 +4831,16 @@ static int img_bitmap(int argc, char **argv) ret = 0; out: + /* + * Manually inactivate the images first because this way we can know whether + * an error occurred. blk_unref() doesn't tell us about failures. + */ + inactivate_ret = bdrv_inactivate_all(); + if (inactivate_ret < 0) { + error_report("Error while closing the image: %s", strerror(-inactivate_ret)); + ret = 1; + } + blk_unref(src); blk_unref(blk); qemu_opts_del(opts); |