From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org
Cc: pl@kamp.de, quintela@redhat.com
Subject: [Qemu-devel] [PULL 3/7] migration: check pre_save return in vmstate_save_state
Date: Wed, 27 Sep 2017 14:57:38 +0100 [thread overview]
Message-ID: <20170927135742.19724-4-dgilbert@redhat.com> (raw)
In-Reply-To: <20170927135742.19724-1-dgilbert@redhat.com>
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Check the return value of pre_save state and fail vmstate_save_state
if the pre_save failed.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170925112917.21340-3-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>
---
include/migration/vmstate.h | 4 ++--
migration/trace-events | 1 +
migration/vmstate.c | 12 ++++++++++--
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index da46b1a36d..88b55df5ae 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -994,8 +994,8 @@ extern const VMStateInfo vmstate_info_qtailq;
int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque, int version_id);
-void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, QJSON *vmdesc);
+int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
+ void *opaque, QJSON *vmdesc);
bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque);
diff --git a/migration/trace-events b/migration/trace-events
index d2910a6e7b..6f29fcc686 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -40,6 +40,7 @@ savevm_state_iterate(void) ""
savevm_state_cleanup(void) ""
savevm_state_complete_precopy(void) ""
vmstate_save(const char *idstr, const char *vmsd_name) "%s, %s"
+vmstate_save_state_pre_save_res(const char *name, int res) "%s/%d"
vmstate_save_state_loop(const char *name, const char *field, int n_elems) "%s/%s[%d]"
vmstate_save_state_top(const char *idstr) "%s"
vmstate_subsection_save_loop(const char *name, const char *sub) "%s/%s"
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 3226e8eb45..ae8abd3c32 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -308,15 +308,21 @@ bool vmstate_save_needed(const VMStateDescription *vmsd, void *opaque)
}
-void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
+int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque, QJSON *vmdesc)
{
+ int ret = 0;
VMStateField *field = vmsd->fields;
trace_vmstate_save_state_top(vmsd->name);
if (vmsd->pre_save) {
- vmsd->pre_save(opaque);
+ ret = vmsd->pre_save(opaque);
+ trace_vmstate_save_state_pre_save_res(vmsd->name, ret);
+ if (ret) {
+ error_report("pre-save failed: %s", vmsd->name);
+ return ret;
+ }
}
if (vmdesc) {
@@ -381,6 +387,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
}
vmstate_subsection_save(f, vmsd, opaque, vmdesc);
+
+ return 0;
}
static const VMStateDescription *
--
2.13.5
next prev parent reply other threads:[~2017-09-27 13:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 13:57 [Qemu-devel] [PULL 0/7] migration queue Dr. David Alan Gilbert (git)
2017-09-27 13:57 ` [Qemu-devel] [PULL 1/7] migration: disable auto-converge during bulk block migration Dr. David Alan Gilbert (git)
2017-09-27 13:57 ` [Qemu-devel] [PULL 2/7] migration: pre_save return int Dr. David Alan Gilbert (git)
2017-09-27 13:57 ` Dr. David Alan Gilbert (git) [this message]
2017-09-27 13:57 ` [Qemu-devel] [PULL 4/7] migration: Check field save returns Dr. David Alan Gilbert (git)
2017-09-27 13:57 ` [Qemu-devel] [PULL 5/7] migration: wire vmstate_save_state errors up to vmstate_subsection_save Dr. David Alan Gilbert (git)
2017-09-27 13:57 ` [Qemu-devel] [PULL 6/7] migration: Route errors up through vmstate_save Dr. David Alan Gilbert (git)
2017-09-27 13:57 ` [Qemu-devel] [PULL 7/7] migration: Route more error paths Dr. David Alan Gilbert (git)
2017-09-27 23:29 ` [Qemu-devel] [PULL 0/7] migration queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170927135742.19724-4-dgilbert@redhat.com \
--to=dgilbert@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).