qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

migration: wire vmstate_save_state errors up to vmstate_subsection_save

Route the errors from vmstate_save_state up through
vmstate_subsection_save (and back down, all rather recursive).

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170925112917.21340-5-dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Commit message fixed up as per Peter's review

+12 -8
+12 -8
migration/vmstate.c
··· 21 21 #include "trace.h" 22 22 #include "qjson.h" 23 23 24 - static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, 25 - void *opaque, QJSON *vmdesc); 24 + static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, 25 + void *opaque, QJSON *vmdesc); 26 26 static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, 27 27 void *opaque); 28 28 ··· 395 395 json_end_array(vmdesc); 396 396 } 397 397 398 - vmstate_subsection_save(f, vmsd, opaque, vmdesc); 399 - 400 - return 0; 398 + return vmstate_subsection_save(f, vmsd, opaque, vmdesc); 401 399 } 402 400 403 401 static const VMStateDescription * ··· 463 461 return 0; 464 462 } 465 463 466 - static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, 467 - void *opaque, QJSON *vmdesc) 464 + static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, 465 + void *opaque, QJSON *vmdesc) 468 466 { 469 467 const VMStateDescription **sub = vmsd->subsections; 470 468 bool subsection_found = false; 469 + int ret = 0; 471 470 472 471 trace_vmstate_subsection_save_top(vmsd->name); 473 472 while (sub && *sub && (*sub)->needed) { ··· 491 490 qemu_put_byte(f, len); 492 491 qemu_put_buffer(f, (uint8_t *)vmsdsub->name, len); 493 492 qemu_put_be32(f, vmsdsub->version_id); 494 - vmstate_save_state(f, vmsdsub, opaque, vmdesc); 493 + ret = vmstate_save_state(f, vmsdsub, opaque, vmdesc); 494 + if (ret) { 495 + return ret; 496 + } 495 497 496 498 if (vmdesc) { 497 499 json_end_object(vmdesc); ··· 503 505 if (vmdesc && subsection_found) { 504 506 json_end_array(vmdesc); 505 507 } 508 + 509 + return ret; 506 510 }