Blob Blame History Raw
From 08183017ea26569bd0ab226576e9772c768a65e7 Mon Sep 17 00:00:00 2001
From: Max Reitz <mreitz@redhat.com>
Date: Mon, 4 Nov 2013 22:32:05 +0100
Subject: [PATCH 12/87] qcow2_check: Mark image consistent

RH-Author: Max Reitz <mreitz@redhat.com>
Message-id: <1383604354-12743-15-git-send-email-mreitz@redhat.com>
Patchwork-id: 55314
O-Subject: [RHEL-7.0 qemu-kvm PATCH 14/43] qcow2_check: Mark image consistent
Bugzilla: 1004347
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Fam Zheng <famz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

BZ: 1004347

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>
(cherry picked from commit 24530f3e060c71b6c57c7a70336f08a13a8b0a3d)

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

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block/qcow2.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index 90950cb..8a30863 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;
 }
-- 
1.7.1