qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Peek dont read for vmdescription


From: Dr. David Alan Gilbert (git)
Subject: [Qemu-devel] [PATCH] Peek dont read for vmdescription
Date: Mon, 22 Jun 2015 15:49:34 +0100

From: "Dr. David Alan Gilbert" <address@hidden>

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.

Using 'qemu_peek_byte' avoids that.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
 migration/savevm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/migration/savevm.c b/migration/savevm.c
index 2004dce..4bd3709 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1128,9 +1128,14 @@ 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);
+    if (qemu_peek_byte(f, 0) == QEMU_VM_VMDESCRIPTION) {
         uint8_t *buf = g_malloc(0x1000);
+        uint32_t size;
+
+        /* Consume the peeked byte */
+        size = qemu_get_byte(f);
+
+        size = qemu_get_be32(f);
 
         while (size > 0) {
             uint32_t read_chunk = MIN(size, 0x1000);
-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]