Blame SOURCES/kvm-qcow2-Fix-qcow2_truncate-error-return-value.patch

383d26
From 2854a11fc02a664688ddc3ccbd7786f0aec219bd Mon Sep 17 00:00:00 2001
383d26
From: Kevin Wolf <kwolf@redhat.com>
383d26
Date: Thu, 12 Jul 2018 14:42:53 +0200
383d26
Subject: [PATCH 34/89] qcow2: Fix qcow2_truncate() error return value
383d26
383d26
RH-Author: Kevin Wolf <kwolf@redhat.com>
383d26
Message-id: <20180712144258.17303-2-kwolf@redhat.com>
383d26
Patchwork-id: 81325
383d26
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 1/6] qcow2: Fix qcow2_truncate() error return value
383d26
Bugzilla: 1595173
383d26
RH-Acked-by: Max Reitz <mreitz@redhat.com>
383d26
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
RH-Acked-by: John Snow <jsnow@redhat.com>
383d26
383d26
If qcow2_alloc_clusters_at() returns an error, we do need to negate it
383d26
to get back the positive errno code for error_setg_errno(), but we still
383d26
need to return the negative error code.
383d26
383d26
Fixes: 772d1f973f87269f6a4a4ea4b880680f3779bbdf
383d26
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
383d26
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
(cherry picked from commit ae5475e82fd1ebb24f4f77cf28f59ca6548c6136)
383d26
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 block/qcow2.c | 2 +-
383d26
 1 file changed, 1 insertion(+), 1 deletion(-)
383d26
383d26
diff --git a/block/qcow2.c b/block/qcow2.c
383d26
index da74e2a..dbd448c 100644
383d26
--- a/block/qcow2.c
383d26
+++ b/block/qcow2.c
383d26
@@ -3594,7 +3594,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
383d26
         if (clusters_allocated < 0) {
383d26
             error_setg_errno(errp, -clusters_allocated,
383d26
                              "Failed to allocate data clusters");
383d26
-            return -clusters_allocated;
383d26
+            return clusters_allocated;
383d26
         }
383d26
 
383d26
         assert(clusters_allocated == nb_new_data_clusters);
383d26
-- 
383d26
1.8.3.1
383d26