migration/multifd: Clarify Error usage in multifd_channel_connect
The function is currently called from two sites, one always gives it a NULL Error and the other always gives it a non-NULL Error. In the non-NULL case, all it does it trace the error and return. One of the callers already have tracing, add a tracepoint to the other and stop passing the error into the function. Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20231012134343.23757-4-farosas@suse.de>
This commit is contained in:
parent
ee8a7c9c46
commit
967e388987
@ -775,7 +775,7 @@ out:
|
|||||||
|
|
||||||
static bool multifd_channel_connect(MultiFDSendParams *p,
|
static bool multifd_channel_connect(MultiFDSendParams *p,
|
||||||
QIOChannel *ioc,
|
QIOChannel *ioc,
|
||||||
Error *error);
|
Error **errp);
|
||||||
|
|
||||||
static void multifd_tls_outgoing_handshake(QIOTask *task,
|
static void multifd_tls_outgoing_handshake(QIOTask *task,
|
||||||
gpointer opaque)
|
gpointer opaque)
|
||||||
@ -784,13 +784,15 @@ static void multifd_tls_outgoing_handshake(QIOTask *task,
|
|||||||
QIOChannel *ioc = QIO_CHANNEL(qio_task_get_source(task));
|
QIOChannel *ioc = QIO_CHANNEL(qio_task_get_source(task));
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
if (qio_task_propagate_error(task, &err)) {
|
if (!qio_task_propagate_error(task, &err)) {
|
||||||
trace_multifd_tls_outgoing_handshake_error(ioc, error_get_pretty(err));
|
|
||||||
} else {
|
|
||||||
trace_multifd_tls_outgoing_handshake_complete(ioc);
|
trace_multifd_tls_outgoing_handshake_complete(ioc);
|
||||||
|
if (multifd_channel_connect(p, ioc, &err)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!multifd_channel_connect(p, ioc, err)) {
|
trace_multifd_tls_outgoing_handshake_error(ioc, error_get_pretty(err));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error happen, mark multifd_send_thread status as 'quit' although it
|
* Error happen, mark multifd_send_thread status as 'quit' although it
|
||||||
* is not created, and then tell who pay attention to me.
|
* is not created, and then tell who pay attention to me.
|
||||||
@ -799,7 +801,6 @@ static void multifd_tls_outgoing_handshake(QIOTask *task,
|
|||||||
qemu_sem_post(&multifd_send_state->channels_ready);
|
qemu_sem_post(&multifd_send_state->channels_ready);
|
||||||
qemu_sem_post(&p->sem_sync);
|
qemu_sem_post(&p->sem_sync);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void *multifd_tls_handshake_thread(void *opaque)
|
static void *multifd_tls_handshake_thread(void *opaque)
|
||||||
{
|
{
|
||||||
@ -814,7 +815,7 @@ static void *multifd_tls_handshake_thread(void *opaque)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void multifd_tls_channel_connect(MultiFDSendParams *p,
|
static bool multifd_tls_channel_connect(MultiFDSendParams *p,
|
||||||
QIOChannel *ioc,
|
QIOChannel *ioc,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
@ -824,7 +825,7 @@ static void multifd_tls_channel_connect(MultiFDSendParams *p,
|
|||||||
|
|
||||||
tioc = migration_tls_client_create(ioc, hostname, errp);
|
tioc = migration_tls_client_create(ioc, hostname, errp);
|
||||||
if (!tioc) {
|
if (!tioc) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_unref(OBJECT(ioc));
|
object_unref(OBJECT(ioc));
|
||||||
@ -834,31 +835,25 @@ static void multifd_tls_channel_connect(MultiFDSendParams *p,
|
|||||||
qemu_thread_create(&p->thread, "multifd-tls-handshake-worker",
|
qemu_thread_create(&p->thread, "multifd-tls-handshake-worker",
|
||||||
multifd_tls_handshake_thread, p,
|
multifd_tls_handshake_thread, p,
|
||||||
QEMU_THREAD_JOINABLE);
|
QEMU_THREAD_JOINABLE);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool multifd_channel_connect(MultiFDSendParams *p,
|
static bool multifd_channel_connect(MultiFDSendParams *p,
|
||||||
QIOChannel *ioc,
|
QIOChannel *ioc,
|
||||||
Error *error)
|
Error **errp)
|
||||||
{
|
{
|
||||||
trace_multifd_set_outgoing_channel(
|
trace_multifd_set_outgoing_channel(
|
||||||
ioc, object_get_typename(OBJECT(ioc)),
|
ioc, object_get_typename(OBJECT(ioc)),
|
||||||
migrate_get_current()->hostname, error);
|
migrate_get_current()->hostname);
|
||||||
|
|
||||||
if (error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (migrate_channel_requires_tls_upgrade(ioc)) {
|
if (migrate_channel_requires_tls_upgrade(ioc)) {
|
||||||
multifd_tls_channel_connect(p, ioc, &error);
|
|
||||||
if (!error) {
|
|
||||||
/*
|
/*
|
||||||
* tls_channel_connect will call back to this
|
* tls_channel_connect will call back to this
|
||||||
* function after the TLS handshake,
|
* function after the TLS handshake,
|
||||||
* so we mustn't call multifd_send_thread until then
|
* so we mustn't call multifd_send_thread until then
|
||||||
*/
|
*/
|
||||||
return true;
|
return multifd_tls_channel_connect(p, ioc, errp);
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
migration_ioc_register_yank(ioc);
|
migration_ioc_register_yank(ioc);
|
||||||
p->registered_yank = true;
|
p->registered_yank = true;
|
||||||
@ -897,11 +892,12 @@ static void multifd_new_send_channel_async(QIOTask *task, gpointer opaque)
|
|||||||
p->c = ioc;
|
p->c = ioc;
|
||||||
qio_channel_set_delay(p->c, false);
|
qio_channel_set_delay(p->c, false);
|
||||||
p->running = true;
|
p->running = true;
|
||||||
if (multifd_channel_connect(p, ioc, local_err)) {
|
if (multifd_channel_connect(p, ioc, &local_err)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace_multifd_new_send_channel_async_error(p->id, local_err);
|
||||||
multifd_new_send_channel_cleanup(p, ioc, local_err);
|
multifd_new_send_channel_cleanup(p, ioc, local_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +125,7 @@ postcopy_preempt_reset_channel(void) ""
|
|||||||
|
|
||||||
# multifd.c
|
# multifd.c
|
||||||
multifd_new_send_channel_async(uint8_t id) "channel %u"
|
multifd_new_send_channel_async(uint8_t id) "channel %u"
|
||||||
|
multifd_new_send_channel_async_error(uint8_t id, void *err) "channel=%u err=%p"
|
||||||
multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flags, uint32_t next_packet_size) "channel %u packet_num %" PRIu64 " pages %u flags 0x%x next packet size %u"
|
multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flags, uint32_t next_packet_size) "channel %u packet_num %" PRIu64 " pages %u flags 0x%x next packet size %u"
|
||||||
multifd_recv_new_channel(uint8_t id) "channel %u"
|
multifd_recv_new_channel(uint8_t id) "channel %u"
|
||||||
multifd_recv_sync_main(long packet_num) "packet num %ld"
|
multifd_recv_sync_main(long packet_num) "packet num %ld"
|
||||||
@ -144,7 +145,7 @@ multifd_send_thread_start(uint8_t id) "%u"
|
|||||||
multifd_tls_outgoing_handshake_start(void *ioc, void *tioc, const char *hostname) "ioc=%p tioc=%p hostname=%s"
|
multifd_tls_outgoing_handshake_start(void *ioc, void *tioc, const char *hostname) "ioc=%p tioc=%p hostname=%s"
|
||||||
multifd_tls_outgoing_handshake_error(void *ioc, const char *err) "ioc=%p err=%s"
|
multifd_tls_outgoing_handshake_error(void *ioc, const char *err) "ioc=%p err=%s"
|
||||||
multifd_tls_outgoing_handshake_complete(void *ioc) "ioc=%p"
|
multifd_tls_outgoing_handshake_complete(void *ioc) "ioc=%p"
|
||||||
multifd_set_outgoing_channel(void *ioc, const char *ioctype, const char *hostname, void *err) "ioc=%p ioctype=%s hostname=%s err=%p"
|
multifd_set_outgoing_channel(void *ioc, const char *ioctype, const char *hostname) "ioc=%p ioctype=%s hostname=%s"
|
||||||
|
|
||||||
# migration.c
|
# migration.c
|
||||||
await_return_path_close_on_source_close(void) ""
|
await_return_path_close_on_source_close(void) ""
|
||||||
|
Loading…
Reference in New Issue
Block a user