[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/26] migration/tls: extract cleanup function for common-use
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 20/26] migration/tls: extract cleanup function for common-use |
Date: |
Fri, 25 Sep 2020 13:06:49 +0100 |
From: Chuan Zheng <zhengchuan@huawei.com>
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/multifd.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index de34276c43..36d4a403a5 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -719,6 +719,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;
@@ -727,25 +744,18 @@ 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 needs 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(Error **errp)
--
2.26.2
- [PULL 10/26] migration/dirtyrate: skip sampling ramblock with size below MIN_RAMBLOCK_SIZE, (continued)
- [PULL 10/26] migration/dirtyrate: skip sampling ramblock with size below MIN_RAMBLOCK_SIZE, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 11/26] migration/dirtyrate: Implement set_sample_page_period() and is_sample_period_valid(), Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 12/26] migration/dirtyrate: Implement calculate_dirtyrate() function, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 13/26] migration/dirtyrate: Implement qmp_cal_dirty_rate()/qmp_get_dirty_rate() function, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 14/26] migration/dirtyrate: Add trace_calls to make it easier to debug, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 15/26] migration: Truncate state file in xen-save-devices-state, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 16/26] migration: increase max-bandwidth to 128 MiB/s (1 Gib/s), Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 17/26] migration/tls: save hostname into MigrationState, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 18/26] migration/tls: extract migration_tls_client_create for common-use, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 19/26] migration/tls: add tls_hostname into MultiFDSendParams, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 20/26] migration/tls: extract cleanup function for common-use,
Dr. David Alan Gilbert (git) <=
- [PULL 21/26] migration/tls: add support for multifd tls-handshake, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 22/26] migration/tls: add trace points for multifd-tls, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 24/26] virtiofsd: document cache=auto default, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 25/26] virtiofsd: Used glib "shared" thread pool, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 26/26] virtiofsd: Add -o allow_direct_io|no_allow_direct_io options, Dr. David Alan Gilbert (git), 2020/09/25
- [PULL 23/26] monitor: Use LOCK_GUARD macros, Dr. David Alan Gilbert (git), 2020/09/25
- Re: [PULL 00/26] migration and friends queue, no-reply, 2020/09/25