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

Re: [Xen-devel] [PATCH v2 COLOPre 01/13] libxc/restore: fix error handle of process_record



On Mon, 2015-06-08 at 11:43 +0800, Yang Hongyang wrote:
> If the err is RECORD_NOT_PROCESSED, and it is an optional record,
> restore will still fail. The patch fix this.

Whichever approach you take to fixing this, please say _how_ the change
fixes it, it's not at all clear why moving this code should matter.

And if there is an ulterior motive behind the move, please say that too.

> 
> Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
>  tools/libxc/xc_sr_restore.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
> index 9e27dba..2d2edd3 100644
> --- a/tools/libxc/xc_sr_restore.c
> +++ b/tools/libxc/xc_sr_restore.c
> @@ -560,19 +560,6 @@ static int process_record(struct xc_sr_context *ctx, 
> struct xc_sr_record *rec)
>      free(rec->data);
>      rec->data = NULL;
>  
> -    if ( rc == RECORD_NOT_PROCESSED )
> -    {
> -        if ( rec->type & REC_TYPE_OPTIONAL )
> -            DPRINTF("Ignoring optional record %#x (%s)",
> -                    rec->type, rec_type_to_str(rec->type));
> -        else
> -        {
> -            ERROR("Mandatory record %#x (%s) not handled",
> -                  rec->type, rec_type_to_str(rec->type));
> -            rc = -1;
> -        }
> -    }
> -
>      return rc;
>  }
>  
> @@ -678,7 +665,20 @@ static int restore(struct xc_sr_context *ctx)
>          else
>          {
>              rc = process_record(ctx, &rec);
> -            if ( rc )
> +            if ( rc == RECORD_NOT_PROCESSED )
> +            {
> +                if ( rec.type & REC_TYPE_OPTIONAL )
> +                    DPRINTF("Ignoring optional record %#x (%s)",
> +                            rec.type, rec_type_to_str(rec.type));
> +                else
> +                {
> +                    ERROR("Mandatory record %#x (%s) not handled",
> +                          rec.type, rec_type_to_str(rec.type));
> +                    rc = -1;
> +                    goto err;
> +                }
> +            }
> +            else if ( rc )
>                  goto err;
>          }
>  



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.