diff options
author | Ivan Ren <renyime@gmail.com> | 2019-06-25 21:18:19 +0800 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2019-07-24 14:47:21 +0200 |
commit | f193bc0c5342496ce07355c0c30394560a7f4738 (patch) | |
tree | 1a0d34b3f572236768cad67771c04a8078806b9c /migration/ram.c | |
parent | 3c3ca25d1f067f93876730cb55c59d43194fe815 (diff) | |
download | qemu-f193bc0c5342496ce07355c0c30394560a7f4738.zip qemu-f193bc0c5342496ce07355c0c30394560a7f4738.tar.gz qemu-f193bc0c5342496ce07355c0c30394560a7f4738.tar.bz2 |
migration: fix migrate_cancel multifd migration leads destination hung forever
When migrate_cancel a multifd migration, if run sequence like this:
[source] [destination]
multifd_send_sync_main[finish]
multifd_recv_thread wait &p->sem_sync
shutdown to_dst_file
detect error from_src_file
send RAM_SAVE_FLAG_EOS[fail] [no chance to run multifd_recv_sync_main]
multifd_load_cleanup
join multifd receive thread forever
will lead destination qemu hung at following stack:
pthread_join
qemu_thread_join
multifd_load_cleanup
process_incoming_migration_co
coroutine_trampoline
Signed-off-by: Ivan Ren <ivanren@tencent.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <1561468699-9819-4-git-send-email-ivanren@tencent.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/ram.c')
-rw-r--r-- | migration/ram.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/migration/ram.c b/migration/ram.c index eb67167..889148d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1292,6 +1292,11 @@ int multifd_load_cleanup(Error **errp) if (p->running) { p->quit = true; + /* + * multifd_recv_thread may hung at MULTIFD_FLAG_SYNC handle code, + * however try to wakeup it without harm in cleanup phase. + */ + qemu_sem_post(&p->sem_sync); qemu_thread_join(&p->thread); } object_unref(OBJECT(p->c)); |