Browse Source

migration: Keep s->rp_state.from_dst_file open until migration ends

This will be used in the next patch to allow COLO to reuse the return path.

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260302-colo_unit_test_multifd-v11-20-d653fb3b1d80@web.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
master
Lukas Straub 4 weeks ago
committed by Fabiano Rosas
parent
commit
64763e8ca6
  1. 19
      migration/migration.c

19
migration/migration.c

@ -97,7 +97,8 @@ static GSList *migration_blockers[MIG_MODE__MAX];
static bool migration_object_check(MigrationState *ms, Error **errp); static bool migration_object_check(MigrationState *ms, Error **errp);
static bool migration_switchover_start(MigrationState *s, Error **errp); static bool migration_switchover_start(MigrationState *s, Error **errp);
static bool close_return_path_on_source(MigrationState *s); static bool stop_return_path_thread_on_source(MigrationState *s);
static void migration_release_dst_files(MigrationState *ms);
static void migration_completion_end(MigrationState *s); static void migration_completion_end(MigrationState *s);
static void migration_downtime_start(MigrationState *s) static void migration_downtime_start(MigrationState *s)
@ -1281,7 +1282,8 @@ static void migration_cleanup(MigrationState *s)
cpr_state_close(); cpr_state_close();
cpr_transfer_source_destroy(s); cpr_transfer_source_destroy(s);
close_return_path_on_source(s); stop_return_path_thread_on_source(s);
migration_release_dst_files(s);
if (s->migration_thread_running) { if (s->migration_thread_running) {
bql_unlock(); bql_unlock();
@ -2217,6 +2219,7 @@ static void migration_release_dst_files(MigrationState *ms)
* locking needed because this qemufile should only be managed by * locking needed because this qemufile should only be managed by
* return path thread. * return path thread.
*/ */
assert(!ms->rp_state.rp_thread_created);
if (ms->postcopy_qemufile_src) { if (ms->postcopy_qemufile_src) {
migration_ioc_unregister_yank_from_file(ms->postcopy_qemufile_src); migration_ioc_unregister_yank_from_file(ms->postcopy_qemufile_src);
qemu_file_shutdown(ms->postcopy_qemufile_src); qemu_file_shutdown(ms->postcopy_qemufile_src);
@ -2224,7 +2227,9 @@ static void migration_release_dst_files(MigrationState *ms)
ms->postcopy_qemufile_src = NULL; ms->postcopy_qemufile_src = NULL;
} }
qemu_fclose(file); if (file) {
qemu_fclose(file);
}
} }
/* /*
@ -2410,7 +2415,7 @@ static void open_return_path_on_source(MigrationState *ms)
} }
/* Return true if error detected, or false otherwise */ /* Return true if error detected, or false otherwise */
static bool close_return_path_on_source(MigrationState *ms) static bool stop_return_path_thread_on_source(MigrationState *ms)
{ {
if (!ms->rp_state.rp_thread_created) { if (!ms->rp_state.rp_thread_created) {
return false; return false;
@ -2432,7 +2437,6 @@ static bool close_return_path_on_source(MigrationState *ms)
qemu_thread_join(&ms->rp_state.rp_thread); qemu_thread_join(&ms->rp_state.rp_thread);
ms->rp_state.rp_thread_created = false; ms->rp_state.rp_thread_created = false;
migration_release_dst_files(ms);
trace_migration_return_path_end_after(); trace_migration_return_path_end_after();
/* Return path will persist the error in MigrationState when quit */ /* Return path will persist the error in MigrationState when quit */
@ -2795,7 +2799,7 @@ static void migration_completion(MigrationState *s)
goto fail; goto fail;
} }
if (close_return_path_on_source(s)) { if (stop_return_path_thread_on_source(s)) {
goto fail; goto fail;
} }
@ -2949,7 +2953,8 @@ static MigThrError postcopy_pause(MigrationState *s)
* path and just wait for the thread to finish. It will be * path and just wait for the thread to finish. It will be
* re-created when we resume. * re-created when we resume.
*/ */
close_return_path_on_source(s); stop_return_path_thread_on_source(s);
migration_release_dst_files(s);
/* /*
* Current channel is possibly broken. Release it. Note that this is * Current channel is possibly broken. Release it. Note that this is

Loading…
Cancel
Save