qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 07/10] qcow2: Improve error handling in update_r


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 07/10] qcow2: Improve error handling in update_refcount
Date: Wed, 20 Jan 2010 10:47:10 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Thunderbird/3.0

Am 19.01.2010 19:51, schrieb Christoph Hellwig:
> On Mon, Jan 18, 2010 at 01:11:33PM +0100, Kevin Wolf wrote:
>> If update_refcount fails, try to undo any changes made so far to avoid
>> inconsistencies in the image file.
>>
>> Signed-off-by: Kevin Wolf <address@hidden>
>> ---
>>  block/qcow2-refcount.c |   32 +++++++++++++++++++++++++-------
>>  1 files changed, 25 insertions(+), 7 deletions(-)
>>
> 
>> +    /*
>> +     * Try do undo any updates if an error is returned (This may succeed in
>> +     * some cases like ENOSPC for allocating a new refcount block)
>> +     */
>> +    if (ret < 0) {
>> +        int dummy;
>> +        dummy = update_refcount(bs, offset, cluster_offset - offset, 
>> -addend);
> 
> So we recursively call into update_refcount here.  What happens an error
> causes all updates to fail?

We're only reverting writes that have succeeded. If reverting fails,
there are no successful writes and update_refcount will be called with a
length of 0 (which never fails). In the worst case we're only reverting
one cluster less with each recursive call - however, I don't think
that's a realistic scenario.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]