qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, stefanha@redhat.com,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 1/6] qcow2: Fix qcow2_truncate() error return value
Date: Tue, 26 Jun 2018 16:24:29 +0200	[thread overview]
Message-ID: <20180626142434.22090-2-kwolf@redhat.com> (raw)
In-Reply-To: <20180626142434.22090-1-kwolf@redhat.com>

If qcow2_alloc_clusters_at() returns an error, we do need to negate it
to get back the positive errno code for error_setg_errno(), but we still
need to return the negative error code.

Fixes: 772d1f973f87269f6a4a4ea4b880680f3779bbdf
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index a3a3aa2a97..6b2e1e1058 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3597,7 +3597,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
         if (clusters_allocated < 0) {
             error_setg_errno(errp, -clusters_allocated,
                              "Failed to allocate data clusters");
-            return -clusters_allocated;
+            return clusters_allocated;
         }
 
         assert(clusters_allocated == nb_new_data_clusters);
-- 
2.13.6

  reply	other threads:[~2018-06-26 14:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 14:24 [Qemu-devel] [PATCH v2 0/6] file-posix: Make truncate/preallocate asynchronous Kevin Wolf
2018-06-26 14:24 ` Kevin Wolf [this message]
2018-06-27 11:51   ` [Qemu-devel] [PATCH v2 1/6] qcow2: Fix qcow2_truncate() error return value Stefan Hajnoczi
2018-06-26 14:24 ` [Qemu-devel] [PATCH v2 2/6] block: Convert .bdrv_truncate callback to coroutine_fn Kevin Wolf
2018-06-27 11:54   ` Stefan Hajnoczi
2018-06-26 14:24 ` [Qemu-devel] [PATCH v2 3/6] qcow2: Remove coroutine trampoline for preallocate_co() Kevin Wolf
2018-06-27 11:55   ` Stefan Hajnoczi
2018-06-26 14:24 ` [Qemu-devel] [PATCH v2 4/6] block: Move bdrv_truncate() implementation to io.c Kevin Wolf
2018-06-27 11:56   ` Stefan Hajnoczi
2018-06-26 14:24 ` [Qemu-devel] [PATCH v2 5/6] block: Use tracked request for truncate Kevin Wolf
2018-06-27 11:57   ` Stefan Hajnoczi
2018-06-26 14:24 ` [Qemu-devel] [PATCH v2 6/6] file-posix: Make .bdrv_co_truncate asynchronous Kevin Wolf
2018-06-27 11:57   ` Stefan Hajnoczi
2018-06-27 11:58 ` [Qemu-devel] [PATCH v2 0/6] file-posix: Make truncate/preallocate asynchronous Stefan Hajnoczi
2018-06-27 12:42   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180626142434.22090-2-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).