Skip to content
Snippets Groups Projects
Commit 36e9aab3 authored by Fabiano Rosas's avatar Fabiano Rosas Committed by Stefan Hajnoczi
Browse files

migration: Move return path cleanup to main migration thread


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: default avatarPeter Xu <peterx@redhat.com>
Signed-off-by: default avatarFabiano Rosas <farosas@suse.de>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230918172822.19052-9-farosas@suse.de>
parent ef796ee9
No related branches found
No related tags found
No related merge requests found
......@@ -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)
{
......@@ -1178,6 +1179,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) {
......@@ -1997,7 +2004,6 @@ out:
}
trace_source_return_path_thread_end();
migration_release_dst_files(ms);
rcu_unregister_thread();
return NULL;
}
......@@ -2051,6 +2057,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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment