[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 07/10] migration: Move return path cleanup to main migration t
From: |
Fabiano Rosas |
Subject: |
[PATCH v6 07/10] migration: Move return path cleanup to main migration thread |
Date: |
Mon, 11 Sep 2023 14:13:17 -0300 |
Now that the return path thread is allowed to finish during a paused
migration, we can move the cleanup of the QEMUFiles to the main
migration thread.
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/migration.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/migration/migration.c b/migration/migration.c
index 7dfcbc3634..7fec57ad7f 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -98,6 +98,7 @@ static int migration_maybe_pause(MigrationState *s,
int *current_active_state,
int new_state);
static void migrate_fd_cancel(MigrationState *s);
+static int await_return_path_close_on_source(MigrationState *s);
static bool migration_needs_multiple_sockets(void)
{
@@ -1177,6 +1178,12 @@ static void migrate_fd_cleanup(MigrationState *s)
qemu_fclose(tmp);
}
+ /*
+ * We already cleaned up to_dst_file, so errors from the return
+ * path might be due to that, ignore them.
+ */
+ await_return_path_close_on_source(s);
+
assert(!migration_is_active(s));
if (s->state == MIGRATION_STATUS_CANCELLING) {
@@ -1985,7 +1992,6 @@ out:
}
trace_source_return_path_thread_end();
- migration_release_dst_files(ms);
rcu_unregister_thread();
return NULL;
}
@@ -2039,6 +2045,9 @@ static int
await_return_path_close_on_source(MigrationState *ms)
ret = ms->rp_state.error;
ms->rp_state.error = false;
+
+ migration_release_dst_files(ms);
+
trace_migration_return_path_end_after(ret);
return ret;
}
--
2.35.3
- [PATCH v6 00/10] Fix segfault on migration return path, Fabiano Rosas, 2023/09/11
- [PATCH v6 02/10] migration: Fix possible races when shutting down the return path, Fabiano Rosas, 2023/09/11
- [PATCH v6 01/10] migration: Fix possible race when setting rp_state.error, Fabiano Rosas, 2023/09/11
- [PATCH v6 05/10] migration: Consolidate return path closing code, Fabiano Rosas, 2023/09/11
- [PATCH v6 03/10] migration: Fix possible race when shutting down to_dst_file, Fabiano Rosas, 2023/09/11
- [PATCH v6 06/10] migration: Replace the return path retry logic, Fabiano Rosas, 2023/09/11
- [PATCH v6 07/10] migration: Move return path cleanup to main migration thread,
Fabiano Rosas <=
- [PATCH v6 08/10] migration/yank: Use channel features, Fabiano Rosas, 2023/09/11
- [PATCH v6 04/10] migration: Remove redundant cleanup of postcopy_qemufile_src, Fabiano Rosas, 2023/09/11
- [PATCH v6 09/10] migration/yank: Keep track of registered yank instances, Fabiano Rosas, 2023/09/11