Patchwork [PULL,25/26] qcow2_check: Mark image consistent

login
register
mail settings
Submitter Kevin Wolf
Date Aug. 30, 2013, 2:30 p.m.
Message ID <1377873051-18981-26-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/271318/
State New
Headers show

Comments

Kevin Wolf - Aug. 30, 2013, 2:30 p.m.
From: Max Reitz <mreitz@redhat.com>

If no corruptions remain after an image repair (and no errors have been
encountered), clear the corrupt flag in qcow2_check.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch

diff --git a/block/qcow2.c b/block/qcow2.c
index 05e002d..4bc679a 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -312,7 +312,11 @@  static int qcow2_check(BlockDriverState *bs, BdrvCheckResult *result,
     }
 
     if (fix && result->check_errors == 0 && result->corruptions == 0) {
-        return qcow2_mark_clean(bs);
+        ret = qcow2_mark_clean(bs);
+        if (ret < 0) {
+            return ret;
+        }
+        return qcow2_mark_consistent(bs);
     }
     return ret;
 }