On 08/06/15 10:37, Yang Hongyang wrote: > > > On 06/08/2015 05:24 PM, Andrew Cooper wrote: >> On 08/06/15 04:43, Yang Hongyang wrote: >>> If the err is RECORD_NOT_PROCESSED, and it is an optional record, >>> restore will still fail. The patch fix this. >>> >>> Signed-off-by: Yang Hongyang <yan...@cn.fujitsu.com> >>> CC: Ian Campbell <ian.campb...@citrix.com> >>> CC: Ian Jackson <ian.jack...@eu.citrix.com> >>> CC: Wei Liu <wei.l...@citrix.com> >>> CC: Andrew Cooper <andrew.coop...@citrix.com> >>> --- >>> 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)); >> >> You would be best setting rc to 0 here, rather than moving the logic out >> of process_record(). > > There will be another error type in COLO, which indicates a failover, > that > needs to be handled in restore(), so I moved the error handling down to > avoid duplex code...Otherwise, in process_record, RECORD_NOT_PROCESSED is > handled, and in restore another error type returned from > process_record is > handled...
Ah ok - I will wait till I get that far through the series. ~Andrew > >> >> ~Andrew >> >>> - 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@lists.xen.org http://lists.xen.org/xen-devel