Peter Xu <pet...@redhat.com> writes: > On Fri, Mar 07, 2025 at 05:15:03PM +0530, Prasad Pandit wrote: >> diff --git a/migration/migration.c b/migration/migration.c >> index 65fc4f5eed..da2c49c303 100644 >> --- a/migration/migration.c >> +++ b/migration/migration.c >> @@ -3401,9 +3401,10 @@ static MigIterateState >> migration_iteration_run(MigrationState *s) >> if (!in_postcopy && must_precopy <= s->threshold_size >> && can_switchover && qatomic_read(&s->start_postcopy)) { >> if (migrate_multifd()) { >> - multifd_send_flush(); >> - multifd_send_sync_main(MULTIFD_SYNC_LOCAL); >> - qemu_savevm_send_multifd_recv_sync(s->to_dst_file); >> +/* multifd_send_flush(); >> + * multifd_send_sync_main(MULTIFD_SYNC_ALL); >> + * qemu_savevm_send_multifd_recv_sync(s->to_dst_file); >> + */ >> + qemu_savevm_state_complete_multifd(s->to_dst_file); >> multifd_send_shutdown(); > > Forgot to mention one thing: > > If you do flush and sync, IMHO we can keep the threads there and remove > this shutdown, as long as we are sure it'll be properly shutdown when > cleanup. > > With the assertion in dest threads, I think it should be OK.
Good point. Shutdown at random places makes it difficult to protect against cleanup races.