From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH v2 06/10] qcow2: Fix error handling in grow_refcount_table
Date: Wed, 20 Jan 2010 15:03:03 +0100 [thread overview]
Message-ID: <1263996186-6623-7-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1263996186-6623-1-git-send-email-kwolf@redhat.com>
Return the appropriate error code instead of -EIO.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2-refcount.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 3a2d44a..6f449c6 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -168,9 +168,12 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
cpu_to_be64w((uint64_t*)data, table_offset);
cpu_to_be32w((uint32_t*)(data + 8), refcount_table_clusters);
- if (bdrv_pwrite(s->hd, offsetof(QCowHeader, refcount_table_offset),
- data, sizeof(data)) != sizeof(data))
+ ret = bdrv_pwrite(s->hd, offsetof(QCowHeader, refcount_table_offset),
+ data, sizeof(data));
+ if (ret != sizeof(data)) {
goto fail;
+ }
+
qemu_free(s->refcount_table);
old_table_offset = s->refcount_table_offset;
old_table_size = s->refcount_table_size;
@@ -183,7 +186,7 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
return 0;
fail:
qemu_free(new_table);
- return -EIO;
+ return ret < 0 ? ret : -EIO;
}
--
1.6.5.2
next prev parent reply other threads:[~2010-01-20 14:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 14:02 [Qemu-devel] [PATCH v2 00/10] qcow2 error path fixes Kevin Wolf
2010-01-20 14:02 ` [Qemu-devel] [PATCH v2 01/10] qcow2: Fix error handling in qcow2_grow_l1_table Kevin Wolf
2010-01-26 21:37 ` Anthony Liguori
2010-01-27 8:56 ` Kevin Wolf
2010-01-20 14:02 ` [Qemu-devel] [PATCH v2 02/10] qcow2: Fix error handling in qcow_save_vmstate Kevin Wolf
2010-01-20 14:03 ` [Qemu-devel] [PATCH v2 03/10] qcow2: Return 0/-errno in get_cluster_table Kevin Wolf
2010-01-20 14:03 ` [Qemu-devel] [PATCH v2 04/10] qcow2: Return 0/-errno in qcow2_alloc_cluster_offset Kevin Wolf
2010-01-20 14:03 ` [Qemu-devel] [PATCH v2 05/10] block: Return original error codes in bdrv_pread/write Kevin Wolf
2010-01-20 14:03 ` Kevin Wolf [this message]
2010-01-20 14:03 ` [Qemu-devel] [PATCH v2 07/10] qcow2: Improve error handling in update_refcount Kevin Wolf
2010-01-20 14:03 ` [Qemu-devel] [PATCH v2 08/10] qcow2: Allow updating no refcounts Kevin Wolf
2010-01-20 14:03 ` [Qemu-devel] [PATCH v2 09/10] qcow2: Don't ignore update_refcount return value Kevin Wolf
2010-01-20 14:04 ` [Qemu-devel] [PATCH v2 10/10] qcow2: Don't ignore qcow2_alloc_clusters " 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=1263996186-6623-7-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).