aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@suse.de>2024-02-06 18:51:13 -0300
committerPeter Xu <peterx@redhat.com>2024-02-07 09:53:18 +0800
commite1921f10d9afe651f4887284e85f6789b37e67d3 (patch)
tree6d4f8c01de88f76afc1b44f61f88a914f92b680d /migration
parent3205bebd4fc6dd501fb8b10c93ddce9da18e09db (diff)
downloadqemu-e1921f10d9afe651f4887284e85f6789b37e67d3.zip
qemu-e1921f10d9afe651f4887284e85f6789b37e67d3.tar.gz
qemu-e1921f10d9afe651f4887284e85f6789b37e67d3.tar.bz2
migration/multifd: Join the TLS thread
We're currently leaking the resources of the TLS thread by not joining it and also overwriting the p->thread pointer altogether. Fixes: a1af605bd5 ("migration/multifd: fix hangup with TLS-Multifd due to blocking handshake") Cc: qemu-stable <qemu-stable@nongnu.org> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240206215118.6171-2-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/multifd.c8
-rw-r--r--migration/multifd.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/migration/multifd.c b/migration/multifd.c
index fbdb129..5551711 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -630,6 +630,10 @@ static void multifd_send_terminate_threads(void)
for (i = 0; i < migrate_multifd_channels(); i++) {
MultiFDSendParams *p = &multifd_send_state->params[i];
+ if (p->tls_thread_created) {
+ qemu_thread_join(&p->tls_thread);
+ }
+
if (p->running) {
qemu_thread_join(&p->thread);
}
@@ -921,7 +925,9 @@ static bool multifd_tls_channel_connect(MultiFDSendParams *p,
trace_multifd_tls_outgoing_handshake_start(ioc, tioc, hostname);
qio_channel_set_name(QIO_CHANNEL(tioc), "multifd-tls-outgoing");
p->c = QIO_CHANNEL(tioc);
- qemu_thread_create(&p->thread, "multifd-tls-handshake-worker",
+
+ p->tls_thread_created = true;
+ qemu_thread_create(&p->tls_thread, "multifd-tls-handshake-worker",
multifd_tls_handshake_thread, p,
QEMU_THREAD_JOINABLE);
return true;
diff --git a/migration/multifd.h b/migration/multifd.h
index 78a2317..720c9d5 100644
--- a/migration/multifd.h
+++ b/migration/multifd.h
@@ -73,6 +73,8 @@ typedef struct {
char *name;
/* channel thread id */
QemuThread thread;
+ QemuThread tls_thread;
+ bool tls_thread_created;
/* communication channel */
QIOChannel *c;
/* is the yank function registered */