From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2 COLOPre 01/13] libxc/restore: fix error handle of process_record Date: Wed, 10 Jun 2015 15:55:34 +0100 Message-ID: <1433948134.30003.95.camel@citrix.com> References: <1433734997-26570-1-git-send-email-yanghy@cn.fujitsu.com> <1433734997-26570-2-git-send-email-yanghy@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1433734997-26570-2-git-send-email-yanghy@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Yang Hongyang Cc: wei.liu2@citrix.com, eddie.dong@intel.com, wency@cn.fujitsu.com, andrew.cooper3@citrix.com, yunhong.jiang@intel.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, guijianfeng@cn.fujitsu.com, rshriram@cs.ubc.ca List-Id: xen-devel@lists.xenproject.org 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 > CC: Ian Campbell > CC: Ian Jackson > CC: Wei Liu > CC: Andrew Cooper > --- > 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; > } >