From: Peter Xu Date: Thu, 18 Sep 2025 20:39:37 +0000 (-0400) Subject: migration: Make migration_has_failed() work even for CANCELLING X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dc487044d5c09d32dd19c8e85e76396fbbc9dde1;p=thirdparty%2Fqemu.git migration: Make migration_has_failed() work even for CANCELLING No issue I hit, the change is only from code observation when I am looking at a TLS premature termination issue. We set CANCELLED very late, it means migration_has_failed() may not work correctly if it's invoked before updating CANCELLING to CANCELLED. Allow that state will make migration_has_failed() working as expected even if it's invoked slightly earlier. One current user is the multifd code for the TLS graceful termination, where it's before updating to CANCELLED. Reviewed-by: Juraj Marcin Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/20250918203937.200833-3-peterx@redhat.com Signed-off-by: Peter Xu --- diff --git a/migration/migration.c b/migration/migration.c index 2f55f2784b4..3ff85098d5f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1712,7 +1712,8 @@ int migration_call_notifiers(MigrationState *s, MigrationEventType type, bool migration_has_failed(MigrationState *s) { - return (s->state == MIGRATION_STATUS_CANCELLED || + return (s->state == MIGRATION_STATUS_CANCELLING || + s->state == MIGRATION_STATUS_CANCELLED || s->state == MIGRATION_STATUS_FAILED); }