qcow2_inactivate() prints errors on different failures, let's not exclude qcow2_mark_clean() call.
Still, if image is read-only, no reason to report failed write and no reason even to try write. Write failure is possible when we open dirty image for check in read-only mode. Let's not do it. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> --- block/qcow2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 04994df240..ccfcd0db05 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2699,8 +2699,12 @@ static int qcow2_inactivate(BlockDriverState *bs) local_err = NULL; } - if (result == 0) { - qcow2_mark_clean(bs); + if (result == 0 && bdrv_is_writable(bs)) { + ret = qcow2_mark_clean(bs); + if (ret < 0) { + error_report("Failed to mark qcow2 node '%s' clean", + bdrv_get_device_or_node_name(bs)); + } } return result; -- 2.31.1