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

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