[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] block: mirror - use local_err to avoid NULL
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2] block: mirror - use local_err to avoid NULL errp |
Date: |
Thu, 13 Feb 2014 08:05:42 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 02/13/2014 07:23 AM, Jeff Cody wrote:
> When starting a block job, commit_active_start() relies on whether *errp
> is set by mirror_start_job. This allows it to determine if the mirror
> job start failed, so that it can clean up any changes to open flags from
> the bdrv_reopen(). If errp is NULL, then it will not be able to
> determine if mirror_start_job failed or not.
>
> To avoid this, use a local Error variable, and then propagate the error
> (if any) to errp.
>
> Reported-by: Markus Armbruster <address@hidden>
> Signed-off-by: Jeff Cody <address@hidden>
> ---
> block/mirror.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index 2a43334..ddb5765 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -633,6 +633,8 @@ void commit_active_start(BlockDriverState *bs,
> BlockDriverState *base,
> {
> int64_t length, base_length;
> int orig_base_flags;
> + Error *local_err = NULL;
> +
>
> orig_base_flags = bdrv_get_flags(base);
Why the double blank line?
Besides that,
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature