diff options
| author | Peter Xu <peterx@redhat.com> | 2023-10-04 18:02:32 -0400 |
|---|---|---|
| committer | Juan Quintela <quintela@redhat.com> | 2023-10-11 11:17:05 +0200 |
| commit | 2b2f6f411efa83c70409fa6de2e61ec28221c757 (patch) | |
| tree | 5757612585a791b693ed3d66cff0e926fb1bd3c7 /migration/migration.c | |
| parent | c94143e587875bd70c280d72b1b70d9eefaf6854 (diff) | |
| download | focaccia-qemu-2b2f6f411efa83c70409fa6de2e61ec28221c757.tar.gz focaccia-qemu-2b2f6f411efa83c70409fa6de2e61ec28221c757.zip | |
migration: Introduce migrate_has_error()
Introduce a helper to detect whether MigrationState.error is set for whatever reason. This is preparation work for any thread (e.g. source return path thread) to setup errors in an unified way to MigrationState, rather than relying on its own way to set errors (mark_source_rp_bad()). Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20231004220240.167175-3-peterx@redhat.com>
Diffstat (limited to 'migration/migration.c')
| -rw-r--r-- | migration/migration.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c index 57f9e9ed0c..409eb3e916 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1234,6 +1234,13 @@ void migrate_set_error(MigrationState *s, const Error *error) } } +bool migrate_has_error(MigrationState *s) +{ + /* The lock is not helpful here, but still follow the rule */ + QEMU_LOCK_GUARD(&s->error_mutex); + return qatomic_read(&s->error); +} + static void migrate_error_free(MigrationState *s) { QEMU_LOCK_GUARD(&s->error_mutex); |