218e99
From 08183017ea26569bd0ab226576e9772c768a65e7 Mon Sep 17 00:00:00 2001
218e99
From: Max Reitz <mreitz@redhat.com>
218e99
Date: Mon, 4 Nov 2013 22:32:05 +0100
218e99
Subject: [PATCH 12/87] qcow2_check: Mark image consistent
218e99
218e99
RH-Author: Max Reitz <mreitz@redhat.com>
218e99
Message-id: <1383604354-12743-15-git-send-email-mreitz@redhat.com>
218e99
Patchwork-id: 55314
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH 14/43] qcow2_check: Mark image consistent
218e99
Bugzilla: 1004347
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Fam Zheng <famz@redhat.com>
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
218e99
BZ: 1004347
218e99
218e99
If no corruptions remain after an image repair (and no errors have been
218e99
encountered), clear the corrupt flag in qcow2_check.
218e99
218e99
Signed-off-by: Max Reitz <mreitz@redhat.com>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
(cherry picked from commit 24530f3e060c71b6c57c7a70336f08a13a8b0a3d)
218e99
218e99
Signed-off-by: Max Reitz <mreitz@redhat.com>
218e99
---
218e99
 block/qcow2.c | 6 +++++-
218e99
 1 file changed, 5 insertions(+), 1 deletion(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 block/qcow2.c |    6 +++++-
218e99
 1 files changed, 5 insertions(+), 1 deletions(-)
218e99
218e99
diff --git a/block/qcow2.c b/block/qcow2.c
218e99
index 90950cb..8a30863 100644
218e99
--- a/block/qcow2.c
218e99
+++ b/block/qcow2.c
218e99
@@ -312,7 +312,11 @@ static int qcow2_check(BlockDriverState *bs, BdrvCheckResult *result,
218e99
     }
218e99
 
218e99
     if (fix && result->check_errors == 0 && result->corruptions == 0) {
218e99
-        return qcow2_mark_clean(bs);
218e99
+        ret = qcow2_mark_clean(bs);
218e99
+        if (ret < 0) {
218e99
+            return ret;
218e99
+        }
218e99
+        return qcow2_mark_consistent(bs);
218e99
     }
218e99
     return ret;
218e99
 }
218e99
-- 
218e99
1.7.1
218e99