All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qcow2: Fix image creation regression
@ 2010-02-23 15:06 Kevin Wolf
  2010-02-23 18:34 ` [Qemu-devel] " Juan Quintela
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2010-02-23 15:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

When checking for errors, commit db89119d compares with the wrong values,
failing image creation even when there was no error. Additionally, if an
error has occured, we can't preallocate the image (it's likely broken).

This unbreaks test 023 of qemu-iotests.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index 6632e6d..0e4cd98 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -986,7 +986,7 @@ static int qcow_create2(const char *filename, int64_t total_size,
     lseek(fd, s->refcount_block_offset, SEEK_SET);
     ret = qemu_write_full(fd, s->refcount_block,
 		    ref_clusters * s->cluster_size);
-    if (ret != s->cluster_size) {
+    if (ret != ref_clusters * s->cluster_size) {
         ret = -1;
         goto exit;
     }
@@ -998,7 +998,7 @@ exit:
     close(fd);
 
     /* Preallocate metadata */
-    if (prealloc) {
+    if (ret == 0 && prealloc) {
         BlockDriverState *bs;
         bs = bdrv_new("");
         bdrv_open(bs, filename, BDRV_O_CACHE_WB | BDRV_O_RDWR);
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] qcow2: Fix image creation regression
  2010-02-23 15:06 [Qemu-devel] [PATCH] qcow2: Fix image creation regression Kevin Wolf
@ 2010-02-23 18:34 ` Juan Quintela
  0 siblings, 0 replies; 2+ messages in thread
From: Juan Quintela @ 2010-02-23 18:34 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

Kevin Wolf <kwolf@redhat.com> wrote:
> When checking for errors, commit db89119d compares with the wrong values,
> failing image creation even when there was no error. Additionally, if an
> error has occured, we can't preallocate the image (it's likely broken).
>
> This unbreaks test 023 of qemu-iotests.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Acked-by: Juan Quintela <quintela@redhat.com>

in the 1st part, I didnt' noticed the difference last time :(

> ---
>  block/qcow2.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 6632e6d..0e4cd98 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -986,7 +986,7 @@ static int qcow_create2(const char *filename, int64_t total_size,
>      lseek(fd, s->refcount_block_offset, SEEK_SET);
>      ret = qemu_write_full(fd, s->refcount_block,
>  		    ref_clusters * s->cluster_size);
> -    if (ret != s->cluster_size) {
> +    if (ret != ref_clusters * s->cluster_size) {
>          ret = -1;
>          goto exit;
>      }
> @@ -998,7 +998,7 @@ exit:
>      close(fd);
>  
>      /* Preallocate metadata */
> -    if (prealloc) {
> +    if (ret == 0 && prealloc) {
>          BlockDriverState *bs;
>          bs = bdrv_new("");
>          bdrv_open(bs, filename, BDRV_O_CACHE_WB | BDRV_O_RDWR);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-23 18:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-23 15:06 [Qemu-devel] [PATCH] qcow2: Fix image creation regression Kevin Wolf
2010-02-23 18:34 ` [Qemu-devel] " Juan Quintela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.