Blame SOURCES/kvm-qcow2-fix-return-error-code-in-qcow2_truncate.patch

9bac43
From cf6287bc4212ad744d04e72ccdd015b9d9552e23 Mon Sep 17 00:00:00 2001
9bac43
From: Max Reitz <mreitz@redhat.com>
9bac43
Date: Mon, 27 Nov 2017 16:19:56 +0100
9bac43
Subject: [PATCH 01/21] qcow2: fix return error code in qcow2_truncate()
9bac43
9bac43
RH-Author: Max Reitz <mreitz@redhat.com>
9bac43
Message-id: <20171127161959.13234-2-mreitz@redhat.com>
9bac43
Patchwork-id: 77912
9bac43
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH 1/4] qcow2: fix return error code in qcow2_truncate()
9bac43
Bugzilla: 1414049
9bac43
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9bac43
RH-Acked-by: Fam Zheng <famz@redhat.com>
9bac43
RH-Acked-by: John Snow <jsnow@redhat.com>
9bac43
9bac43
From: Pavel Butsykin <pbutsykin@virtuozzo.com>
9bac43
9bac43
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
9bac43
Reviewed-by: Eric Blake <eblake@redhat.com>
9bac43
Reviewed-by: John Snow <jsnow@redhat.com>
9bac43
Reviewed-by: Max Reitz <mreitz@redhat.com>
9bac43
Message-id: 20170929121613.25997-2-pbutsykin@virtuozzo.com
9bac43
Signed-off-by: Max Reitz <mreitz@redhat.com>
9bac43
(cherry picked from commit 76a2a30a99c670e9ec1b4a5d976868059c6bc258)
9bac43
Signed-off-by: Max Reitz <mreitz@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 block/qcow2.c | 4 ++--
9bac43
 1 file changed, 2 insertions(+), 2 deletions(-)
9bac43
9bac43
diff --git a/block/qcow2.c b/block/qcow2.c
9bac43
index 40ba26c..af7b1e7 100644
9bac43
--- a/block/qcow2.c
9bac43
+++ b/block/qcow2.c
9bac43
@@ -3159,7 +3159,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
9bac43
         if (old_file_size < 0) {
9bac43
             error_setg_errno(errp, -old_file_size,
9bac43
                              "Failed to inquire current file length");
9bac43
-            return ret;
9bac43
+            return old_file_size;
9bac43
         }
9bac43
 
9bac43
         nb_new_data_clusters = DIV_ROUND_UP(offset - old_length,
9bac43
@@ -3188,7 +3188,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
9bac43
         if (allocation_start < 0) {
9bac43
             error_setg_errno(errp, -allocation_start,
9bac43
                              "Failed to resize refcount structures");
9bac43
-            return -allocation_start;
9bac43
+            return allocation_start;
9bac43
         }
9bac43
 
9bac43
         clusters_allocated = qcow2_alloc_clusters_at(bs, allocation_start,
9bac43
-- 
9bac43
1.8.3.1
9bac43