* [Qemu-devel] [PATCH] Only try and read a VMDescription if it should be there
@ 2015-06-23 16:34 Dr. David Alan Gilbert (git)
2015-07-01 8:34 ` Juan Quintela
0 siblings, 1 reply; 2+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2015-06-23 16:34 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, mrhines, agraf, quintela
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
The VMDescription section maybe after the EOF mark, the current code
does a 'qemu_get_byte' and either gets the header byte identifying the
description or an error (which it ignores). Doing the 'get' upsets
RDMA which hangs on old machine types without the VMDescription.
Just avoid reading the VMDescription if we wouldn't send it.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/savevm.c | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 2091882..482529e 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1125,16 +1125,35 @@ int qemu_loadvm_state(QEMUFile *f)
* Try to read in the VMDESC section as well, so that dumping tools that
* intercept our migration stream have the chance to see it.
*/
- if (qemu_get_byte(f) == QEMU_VM_VMDESCRIPTION) {
- uint32_t size = qemu_get_be32(f);
- uint8_t *buf = g_malloc(0x1000);
-
- while (size > 0) {
- uint32_t read_chunk = MIN(size, 0x1000);
- qemu_get_buffer(f, buf, read_chunk);
- size -= read_chunk;
+
+ /* We've got to be careful; if we don't read the data and just shut the fd
+ * then the sender can error if we close while it's still sending.
+ * We also mustn't read data that isn't there; some transports (RDMA)
+ * will stall waiting for that data when the source has already closed.
+ */
+ if (should_send_vmdesc()) {
+ uint8_t *buf;
+ uint32_t size;
+ section_type = qemu_get_byte(f);
+
+ if (section_type != QEMU_VM_VMDESCRIPTION) {
+ error_report("Expected vmdescription section, but got %d",
+ section_type);
+ /*
+ * It doesn't seem worth failing at this point since
+ * we apparently have an otherwise valid VM state
+ */
+ } else {
+ buf = g_malloc(0x1000);
+ size = qemu_get_be32(f);
+
+ while (size > 0) {
+ uint32_t read_chunk = MIN(size, 0x1000);
+ qemu_get_buffer(f, buf, read_chunk);
+ size -= read_chunk;
+ }
+ g_free(buf);
}
- g_free(buf);
}
cpu_synchronize_all_post_init();
--
2.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Only try and read a VMDescription if it should be there
2015-06-23 16:34 [Qemu-devel] [PATCH] Only try and read a VMDescription if it should be there Dr. David Alan Gilbert (git)
@ 2015-07-01 8:34 ` Juan Quintela
0 siblings, 0 replies; 2+ messages in thread
From: Juan Quintela @ 2015-07-01 8:34 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: amit.shah, mrhines, qemu-devel, agraf
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> The VMDescription section maybe after the EOF mark, the current code
> does a 'qemu_get_byte' and either gets the header byte identifying the
> description or an error (which it ignores). Doing the 'get' upsets
> RDMA which hangs on old machine types without the VMDescription.
>
> Just avoid reading the VMDescription if we wouldn't send it.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-01 8:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 16:34 [Qemu-devel] [PATCH] Only try and read a VMDescription if it should be there Dr. David Alan Gilbert (git)
2015-07-01 8:34 ` Juan Quintela
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).