summary refs log tree commit diff stats
path: root/migration/channel.c
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@suse.de>2025-02-13 14:59:22 -0300
committerFabiano Rosas <farosas@suse.de>2025-02-14 15:19:05 -0300
commit2b667a8c0f7ad423c9141b3a487898c50a6ff5e0 (patch)
treef5ed104882f1df129a3a06b24bf82707077f181a /migration/channel.c
parent4bbadfc55e6ec608df75911b4360e6e995daa28c (diff)
downloadfocaccia-qemu-2b667a8c0f7ad423c9141b3a487898c50a6ff5e0.tar.gz
focaccia-qemu-2b667a8c0f7ad423c9141b3a487898c50a6ff5e0.zip
migration: Fix hang after error in destination setup phase
If the destination side fails at migration_ioc_process_incoming()
before starting the coroutine, it will report the error but QEMU will
not exit.

Set the migration state to FAILED and exit the process if
exit-on-error allows.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2633
Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-ID: <20250213175927.19642-5-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Diffstat (limited to 'migration/channel.c')
-rw-r--r--migration/channel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/migration/channel.c b/migration/channel.c
index 24a91ef911..a547b1fbfe 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -33,6 +33,7 @@
 void migration_channel_process_incoming(QIOChannel *ioc)
 {
     MigrationState *s = migrate_get_current();
+    MigrationIncomingState *mis = migration_incoming_get_current();
     Error *local_err = NULL;
 
     trace_migration_set_incoming_channel(
@@ -47,6 +48,10 @@ void migration_channel_process_incoming(QIOChannel *ioc)
 
     if (local_err) {
         error_report_err(local_err);
+        migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED);
+        if (mis->exit_on_error) {
+            exit(EXIT_FAILURE);
+        }
     }
 }