qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 3/3] qcow2: Always use error path in l2_allocate


From: Benoît Canet
Subject: Re: [Qemu-devel] [PATCH 3/3] qcow2: Always use error path in l2_allocate
Date: Wed, 25 Sep 2013 16:56:40 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Le Wednesday 25 Sep 2013 à 16:37:20 (+0200), Max Reitz a écrit :
> Just returning -errno in some cases prevents
> trace_qcow2_l2_allocate_done from being executed (and, in one case, also
> the unused allocated L2 table from being freed). Always going down the
> error path fixes this.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block/qcow2-cluster.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index 1c3d3fc..c442f6c 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -200,7 +200,8 @@ static int l2_allocate(BlockDriverState *bs, int 
> l1_index, uint64_t **table)
>  
>      l2_offset = qcow2_alloc_clusters(bs, s->l2_size * sizeof(uint64_t));
>      if (l2_offset < 0) {
> -        return l2_offset;
> +        ret = l2_offset;
> +        goto fail;
>      }
>  
>      ret = qcow2_cache_flush(bs, s->refcount_block_cache);
> @@ -213,7 +214,7 @@ static int l2_allocate(BlockDriverState *bs, int 
> l1_index, uint64_t **table)
>      trace_qcow2_l2_allocate_get_empty(bs, l1_index);
>      ret = qcow2_cache_get_empty(bs, s->l2_table_cache, l2_offset, (void**) 
> table);
>      if (ret < 0) {
> -        return ret;
> +        goto fail;
>      }
>  
>      l2_table = *table;
> -- 
> 1.8.3.1
> 
> 
Reviewed-by: Benoit Canet <address@hidden>



reply via email to

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