]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
migration: Flush migration channel after sending data of CMD_PACKAGED
authorJuraj Marcin <jmarcin@redhat.com>
Mon, 3 Nov 2025 18:32:50 +0000 (19:32 +0100)
committerPeter Xu <peterx@redhat.com>
Mon, 3 Nov 2025 21:04:10 +0000 (16:04 -0500)
If the length of the data sent after CMD_PACKAGED is just right, and
there is not much data to send afterward, it is possible part of the
CMD_PACKAGED payload will get left behind in the sending buffer. This
causes the destination side to hang while it tries to load the whole
package and initiate postcopy.

Signed-off-by: Juraj Marcin <jmarcin@redhat.com>
Link: https://lore.kernel.org/r/20251103183301.3840862-2-jmarcin@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
migration/savevm.c

index 232cae090b1a45805eaa54bbb0544a370fdb574b..fa017378db76c7e9cbd6fde52a7365d82b796d71 100644 (file)
@@ -1142,6 +1142,7 @@ int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len)
     qemu_savevm_command_send(f, MIG_CMD_PACKAGED, 4, (uint8_t *)&tmp);
 
     qemu_put_buffer(f, buf, len);
+    qemu_fflush(f);
 
     return 0;
 }