qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: "Benoît Canet" <benoit.canet@irqsave.net>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] qemu-io: Respect early image end for map
Date: Sat, 11 Oct 2014 11:53:40 +0200	[thread overview]
Message-ID: <5438FE24.5000107@redhat.com> (raw)
In-Reply-To: <20141010120347.GC10091@irqsave.net>

Am 10.10.2014 um 14:03 schrieb Benoît Canet:
>> +        } else if (!num) {
>> +            error_report("Unexpected end of image");
>> +            return 0;
> I think this test can miss some case of Unexpected end of image.
>
> For example supose that in map_is_allocated the first bdrv_is_allocated
> actually succeed then *pnum = num. Then the bottom loop has exit on failure
> and the function return.
>
> in map_f &num is map_is_allocated *pnum so map_f's num != 0 and this very test
> fails to see the unexpected end of image error.

num != 0 because some sectors where successfully queried. In my opinion, 
we should print the information about them we have. Then, the do-while 
loop is repeated; and this time, map_is_allocated() either again returns 
num > 0 (for whatever reason, but I'd be fine with it) or, more 
probably, it'll be num == 0 this time. So the error is not missed, it's 
just printed one iteration later.

Max

> Best regards
>
> Benoît
>
>>           }
>>   
>>           retstr = ret ? "    allocated" : "not allocated";
>> -- 
>> 2.0.4
>>
>>

  reply	other threads:[~2014-10-11  9:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-16 18:54 [Qemu-devel] [PATCH 0/3] block: Fix is_allocated() for truncated images Max Reitz
2014-08-16 18:54 ` [Qemu-devel] [PATCH 1/3] block: Ignore allocation size in underlying file Max Reitz
2014-10-08 21:29   ` Eric Blake
2014-10-10 11:50   ` Benoît Canet
2014-10-11  9:44     ` Max Reitz
2014-10-11 18:48       ` Benoît Canet
2014-08-16 18:54 ` [Qemu-devel] [PATCH 2/3] qemu-io: Respect early image end for map Max Reitz
2014-10-09  4:17   ` Eric Blake
2014-10-10 12:03   ` Benoît Canet
2014-10-11  9:53     ` Max Reitz [this message]
2014-10-11 18:46       ` Benoît Canet
2014-10-11 18:47   ` Benoît Canet
2014-08-16 18:54 ` [Qemu-devel] [PATCH 3/3] iotests: Add test for map commands Max Reitz
2014-10-09  4:18   ` Eric Blake
2014-10-08 19:32 ` [Qemu-devel] [PATCH 0/3] block: Fix is_allocated() for truncated images Max Reitz

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=5438FE24.5000107@redhat.com \
    --to=mreitz@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=kwolf@redhat.com \
    --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).