mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
migration: better error handling with QEMUFile
If the postcopy down due to some reason, we can always see this on dst: qemu-system-x86_64: RP: Received invalid message 0x0000 length 0x0000 However in most cases that's not the real issue. The problem is that qemu_get_be16() has no way to show whether the returned data is valid or not, and we are _always_ assuming it is valid. That's possibly not wise. The best approach to solve this would be: refactoring QEMUFile interface to allow the APIs to return error if there is. However it needs quite a bit of work and testing. For now, let's explicitly check the validity first before using the data in all places for qemu_get_*(). This patch tries to fix most of the cases I can see. Only if we are with this, can we make sure we are processing the valid data, and also can we make sure we can capture the channel down events correctly. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180208103132.28452-2-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
2c9bb29703
commit
7a9ddfbfae
3 changed files with 60 additions and 6 deletions
|
@ -1709,6 +1709,11 @@ static void *source_return_path_thread(void *opaque)
|
|||
header_type = qemu_get_be16(rp);
|
||||
header_len = qemu_get_be16(rp);
|
||||
|
||||
if (qemu_file_get_error(rp)) {
|
||||
mark_source_rp_bad(ms);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (header_type >= MIG_RP_MSG_MAX ||
|
||||
header_type == MIG_RP_MSG_INVALID) {
|
||||
error_report("RP: Received invalid message 0x%04x length 0x%04x",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue