[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/14] qcow2: qcow2_inactivate(): don't call qcow2_mark_clean() w
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH 10/14] qcow2: qcow2_inactivate(): don't call qcow2_mark_clean() when RO |
Date: |
Mon, 7 Feb 2022 17:37:24 +0100 |
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 <vsementsov@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
- [PATCH 00/14] block: blockdev-del force=false, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 02/14] block: drop bdrv_detach_child(), Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 01/14] block: refactor bdrv_remove_file_or_backing_child to bdrv_remove_child, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 04/14] block: add bdrv_try_set_aio_context_tran transaction action, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 03/14] block: bdrv_refresh_perms(): allow external tran, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 13/14] block/file-posix: implement .bdrv_close_safe, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 10/14] qcow2: qcow2_inactivate(): don't call qcow2_mark_clean() when RO,
Vladimir Sementsov-Ogievskiy <=
- [PATCH 06/14] block: bdrv_delete(): drop unnecessary zeroing, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 07/14] block: implemet bdrv_try_unref(), Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 14/14] iotests: add test for blockdev-del(force=false), Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 08/14] qapi/block-core: add 'force' argument to blockdev-del, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 11/14] qcow2: refactor qcow2_inactivate, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 12/14] qcow2: implement .bdrv_close_safe, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 05/14] block: merge bdrv_delete and bdrv_close, Vladimir Sementsov-Ogievskiy, 2022/02/07
- [PATCH 09/14] qcow2: qcow2_inactivate(): use qcow2_flush_caches(), Vladimir Sementsov-Ogievskiy, 2022/02/07