[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH v2 2/3] qcow2: Rewrite alloc_refcount_block/grow
From: |
Juan Quintela |
Subject: |
[Qemu-devel] Re: [PATCH v2 2/3] qcow2: Rewrite alloc_refcount_block/grow_refcount_table |
Date: |
Tue, 23 Feb 2010 17:07:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Kevin Wolf <address@hidden> wrote:
> The current implementation of alloc_refcount_block and grow_refcount_table has
> fundamental problems regarding error handling. There are some places where an
> I/O error means that the image is going to be corrupted. I have found that the
> only way to fix this is to completely rewrite the thing.
>
> In detail, the problem is that the refcount blocks itself are allocated using
> alloc_refcount_noref (to avoid endless recursion when updating the refcount of
> the new refcount block, which migh access just the same refcount block but its
> allocation is not yet completed...). Only at the end of the refcount
> allocation
> the refcount of the refcount block is increased. If an error happens in
> between, the refcount block is in use, but has a refcount of zero and will
> likely be overwritten later.
>
> The new approach is explained in comments in the code. The trick is basically
> to let new refcount blocks describe their own refcount, so their refcount will
> be automatically changed when they are hooked up in the refcount table.
>
> Signed-off-by: Kevin Wolf <address@hidden>
Acked-by: Juan Quintela <address@hidden>