migration/tls: extract cleanup function for common-use
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> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <1600139042-104593-5-git-send-email-zhengchuan@huawei.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
fde932816e
commit
48ae5c26a4
82
migration-tls-extract-cleanup-function-for-common-us.patch
Normal file
82
migration-tls-extract-cleanup-function-for-common-us.patch
Normal file
@ -0,0 +1,82 @@
|
||||
From 29914b97b20a6415476095c913607412a3f7572f Mon Sep 17 00:00:00 2001
|
||||
From: Ying Fang <fangying1@huawei.com>
|
||||
Date: Wed, 2 Dec 2020 11:32:44 +0800
|
||||
Subject: [PATCH] migration/tls: extract cleanup function for common-use
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
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>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Message-Id: <1600139042-104593-5-git-send-email-zhengchuan@huawei.com>
|
||||
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||
---
|
||||
migration/ram.c | 34 ++++++++++++++++++++++------------
|
||||
1 file changed, 22 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/migration/ram.c b/migration/ram.c
|
||||
index bb8f383c3b..2b9d00745c 100644
|
||||
--- a/migration/ram.c
|
||||
+++ b/migration/ram.c
|
||||
@@ -1200,6 +1200,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;
|
||||
@@ -1207,25 +1224,18 @@ static void multifd_new_send_channel_async(QIOTask *task, gpointer opaque)
|
||||
Error *local_err = NULL;
|
||||
|
||||
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->c = QIO_CHANNEL(sioc);
|
||||
qio_channel_set_delay(p->c, false);
|
||||
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(void)
|
||||
--
|
||||
2.27.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user