[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 4/7] migration/tls: extract cleanup function for common-use
From: |
Chuan Zheng |
Subject: |
[PATCH v1 4/7] migration/tls: extract cleanup function for common-use |
Date: |
Wed, 9 Sep 2020 22:52:54 +0800 |
multifd channel cleanup is need if multifd handshake failed,
let's extract it.
Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
Signed-off-by: Yan Jin <jinyan12@huawei.com>
---
migration/multifd.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index 2e04803..b2e741c 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -718,6 +718,23 @@ out:
return NULL;
}
+static void multifd_new_send_channel_cleanup(MultiFDSendParams *p,
+ QIOChannel *ioc, Error *err)
+{
+ migrate_set_error(migrate_get_current(), err);
+ /* Error happen, we need to tell who pay attention to me */
+ qemu_sem_post(&multifd_send_state->channels_ready);
+ qemu_sem_post(&p->sem_sync);
+ /*
+ * Although multifd_send_thread is not created, but main migration
+ * thread neet to judge whether it is running, so we need to mark
+ * its status.
+ */
+ p->quit = true;
+ object_unref(OBJECT(ioc));
+ error_free(err);
+}
+
static void multifd_new_send_channel_async(QIOTask *task, gpointer opaque)
{
MultiFDSendParams *p = opaque;
@@ -726,18 +743,7 @@ static void multifd_new_send_channel_async(QIOTask *task,
gpointer opaque)
trace_multifd_new_send_channel_async(p->id);
if (qio_task_propagate_error(task, &local_err)) {
- migrate_set_error(migrate_get_current(), local_err);
- /* Error happen, we need to tell who pay attention to me */
- qemu_sem_post(&multifd_send_state->channels_ready);
- qemu_sem_post(&p->sem_sync);
- /*
- * Although multifd_send_thread is not created, but main migration
- * thread neet to judge whether it is running, so we need to mark
- * its status.
- */
- p->quit = true;
- object_unref(OBJECT(sioc));
- error_free(local_err);
+ goto cleanup;
} else {
p->s = migrate_get_current();
p->c = QIO_CHANNEL(sioc);
@@ -745,7 +751,11 @@ static void multifd_new_send_channel_async(QIOTask *task,
gpointer opaque)
p->running = true;
qemu_thread_create(&p->thread, p->name, multifd_send_thread, p,
QEMU_THREAD_JOINABLE);
+ return;
}
+
+cleanup:
+ multifd_new_send_channel_cleanup(p, sioc, local_err);
}
int multifd_save_setup(Error **errp)
--
1.8.3.1
- [RFC][PATCH v1 0/7] *** Add Multifd support for TLS migration ***, Chuan Zheng, 2020/09/09
- [PATCH v1 2/7] migration/tls: extract migration_tls_client_create for common-use, Chuan Zheng, 2020/09/09
- [PATCH v1 5/7] migration/tls: add support for tls check, Chuan Zheng, 2020/09/09
- [PATCH v1 6/7] migration/tls: add support for multifd tls-handshake, Chuan Zheng, 2020/09/09
- [PATCH v1 4/7] migration/tls: extract cleanup function for common-use,
Chuan Zheng <=
- [PATCH v1 7/7] migration/tls: add trace points for multifd-tls, Chuan Zheng, 2020/09/09
- [PATCH v1 3/7] migration/tls: add MigrationState into MultiFDSendParams, Chuan Zheng, 2020/09/09
- [PATCH v1 1/7] migration/tls: save hostname into MigrationState, Chuan Zheng, 2020/09/09