[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 10/12] qcow2: Flushing the caches in qcow2_close ma
From: |
Max Reitz |
Subject: |
[Qemu-stable] [PATCH 10/12] qcow2: Flushing the caches in qcow2_close may fail |
Date: |
Tue, 25 Nov 2014 15:08:03 +0100 |
qcow2_cache_flush() may fail; if one of the caches failed to be flushed
successfully to disk in qcow2_close() the image should not be marked
clean, and we should emit a warning.
Cc: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index d120494..2bd2a53 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1428,10 +1428,23 @@ static void qcow2_close(BlockDriverState *bs)
s->l1_table = NULL;
if (!(bs->open_flags & BDRV_O_INCOMING)) {
- qcow2_cache_flush(bs, s->l2_table_cache);
- qcow2_cache_flush(bs, s->refcount_block_cache);
+ int ret1, ret2;
- qcow2_mark_clean(bs);
+ ret1 = qcow2_cache_flush(bs, s->l2_table_cache);
+ ret2 = qcow2_cache_flush(bs, s->refcount_block_cache);
+
+ if (ret1) {
+ error_report("Failed to flush the L2 table cache: %s",
+ strerror(-ret1));
+ }
+ if (ret2) {
+ error_report("Failed to flush the refcount block cache: %s",
+ strerror(-ret2));
+ }
+
+ if (!ret1 && !ret2) {
+ qcow2_mark_clean(bs);
+ }
}
qcow2_cache_destroy(bs, s->l2_table_cache);
--
1.9.3
- [Qemu-stable] [PATCH 03/12] block/nfs: Add create_opts, (continued)
- [Qemu-stable] [PATCH 04/12] block: Check create_opts before image creation, Max Reitz, 2014/11/25
- [Qemu-stable] [PATCH 05/12] qemu-img: Check create_opts before image creation, Max Reitz, 2014/11/25
- [Qemu-stable] [PATCH 06/12] qemu-img: Check create_opts before image amendment, Max Reitz, 2014/11/25
- [Qemu-stable] [PATCH 08/12] iotests: Add test for unsupported image creation, Max Reitz, 2014/11/25
- [Qemu-stable] [PATCH 07/12] iotests: Only kill NBD server if it runs, Max Reitz, 2014/11/25
- [Qemu-stable] [PATCH 09/12] qcow2: Prevent numerical overflow, Max Reitz, 2014/11/25
- [Qemu-stable] [PATCH 10/12] qcow2: Flushing the caches in qcow2_close may fail,
Max Reitz <=
- [Qemu-stable] [PATCH 12/12] block/raw-posix: Fix ret in raw_open_common(), Max Reitz, 2014/11/25
- [Qemu-stable] [PATCH 11/12] qcow2: Respect bdrv_truncate() error, Max Reitz, 2014/11/25