From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Leonardo Bras <leobras.c@gmail.com>
Cc: lukasstraub2@web.de, berrange@redhat.com, qemu-devel@nongnu.org,
peterx@redhat.com, Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH v3 1/1] yank: Unregister function when using TLS migration
Date: Tue, 8 Jun 2021 18:51:08 +0100 [thread overview]
Message-ID: <YL+uDA7zo73A7e1j@work-vm> (raw)
In-Reply-To: <20210601054030.1153249-1-leobras.c@gmail.com>
* Leonardo Bras (leobras.c@gmail.com) wrote:
> After yank feature was introduced in migration, whenever migration
> is started using TLS, the following error happens in both source and
> destination hosts:
>
> (qemu) qemu-kvm: ../util/yank.c:107: yank_unregister_instance:
> Assertion `QLIST_EMPTY(&entry->yankfns)' failed.
>
> This happens because of a missing yank_unregister_function() when using
> qio-channel-tls.
>
> Fix this by also allowing TYPE_QIO_CHANNEL_TLS object type to perform
> yank_unregister_function() in channel_close() and multifd_load_cleanup().
>
> Also, inside migration_channel_connect() and
> migration_channel_process_incoming() move yank_register_function() so
> it only runs once on a TLS migration.
>
> Fixes: b5eea99ec2f ("migration: Add yank feature", 2021-01-13)
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1964326
> Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
Queued; thank you!
> --
> Changes since v2:
> - Dropped all references to ioc->master
> - yank_register_function() and yank_unregister_function() now only run
> once in a TLS migration.
>
> Changes since v1:
> - Cast p->c to QIOChannelTLS into multifd_load_cleanup()
> ---
> migration/channel.c | 26 ++++++++++++++------------
> migration/multifd.c | 3 ++-
> migration/qemu-file-channel.c | 4 +++-
> 3 files changed, 19 insertions(+), 14 deletions(-)
>
> diff --git a/migration/channel.c b/migration/channel.c
> index c9ee902021..01275a9162 100644
> --- a/migration/channel.c
> +++ b/migration/channel.c
> @@ -38,18 +38,19 @@ void migration_channel_process_incoming(QIOChannel *ioc)
> trace_migration_set_incoming_channel(
> ioc, object_get_typename(OBJECT(ioc)));
>
> - if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) {
> - yank_register_function(MIGRATION_YANK_INSTANCE,
> - migration_yank_iochannel,
> - QIO_CHANNEL(ioc));
> - }
> -
> if (s->parameters.tls_creds &&
> *s->parameters.tls_creds &&
> !object_dynamic_cast(OBJECT(ioc),
> TYPE_QIO_CHANNEL_TLS)) {
> migration_tls_channel_process_incoming(s, ioc, &local_err);
> } else {
> + if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) ||
> + object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) {
> + yank_register_function(MIGRATION_YANK_INSTANCE,
> + migration_yank_iochannel,
> + QIO_CHANNEL(ioc));
> + }
> +
> migration_ioc_process_incoming(ioc, &local_err);
> }
>
> @@ -76,12 +77,6 @@ void migration_channel_connect(MigrationState *s,
> ioc, object_get_typename(OBJECT(ioc)), hostname, error);
>
> if (!error) {
> - if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) {
> - yank_register_function(MIGRATION_YANK_INSTANCE,
> - migration_yank_iochannel,
> - QIO_CHANNEL(ioc));
> - }
> -
> if (s->parameters.tls_creds &&
> *s->parameters.tls_creds &&
> !object_dynamic_cast(OBJECT(ioc),
> @@ -99,6 +94,13 @@ void migration_channel_connect(MigrationState *s,
> } else {
> QEMUFile *f = qemu_fopen_channel_output(ioc);
>
> + if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) ||
> + object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) {
> + yank_register_function(MIGRATION_YANK_INSTANCE,
> + migration_yank_iochannel,
> + QIO_CHANNEL(ioc));
> + }
> +
> qemu_mutex_lock(&s->qemu_file_lock);
> s->to_dst_file = f;
> qemu_mutex_unlock(&s->qemu_file_lock);
> diff --git a/migration/multifd.c b/migration/multifd.c
> index 0a4803cfcc..2e8f001bc0 100644
> --- a/migration/multifd.c
> +++ b/migration/multifd.c
> @@ -987,7 +987,8 @@ int multifd_load_cleanup(Error **errp)
> for (i = 0; i < migrate_multifd_channels(); i++) {
> MultiFDRecvParams *p = &multifd_recv_state->params[i];
>
> - if (object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_SOCKET)
> + if ((object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_SOCKET) ||
> + object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_TLS))
> && OBJECT(p->c)->ref == 1) {
> yank_unregister_function(MIGRATION_YANK_INSTANCE,
> migration_yank_iochannel,
> diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
> index 876d05a540..fad340ea7a 100644
> --- a/migration/qemu-file-channel.c
> +++ b/migration/qemu-file-channel.c
> @@ -26,6 +26,7 @@
> #include "qemu-file-channel.h"
> #include "qemu-file.h"
> #include "io/channel-socket.h"
> +#include "io/channel-tls.h"
> #include "qemu/iov.h"
> #include "qemu/yank.h"
> #include "yank_functions.h"
> @@ -106,7 +107,8 @@ static int channel_close(void *opaque, Error **errp)
> int ret;
> QIOChannel *ioc = QIO_CHANNEL(opaque);
> ret = qio_channel_close(ioc, errp);
> - if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)
> + if ((object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) ||
> + object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS))
> && OBJECT(ioc)->ref == 1) {
> yank_unregister_function(MIGRATION_YANK_INSTANCE,
> migration_yank_iochannel,
> --
> 2.31.1
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2021-06-08 17:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 5:40 [PATCH v3 1/1] yank: Unregister function when using TLS migration Leonardo Bras
2021-06-01 11:00 ` Lukas Straub
2021-06-01 17:48 ` Leonardo Brás
2021-06-01 14:50 ` Peter Xu
2021-06-01 15:32 ` Lukas Straub
2021-06-01 16:04 ` Peter Xu
2021-06-01 20:49 ` Leonardo Brás
2021-06-08 17:51 ` Dr. David Alan Gilbert [this message]
2021-06-14 11:57 ` Dr. David Alan Gilbert
2021-06-27 11:10 ` Alexander Graf
2021-06-28 11:28 ` Dr. David Alan Gilbert
2021-06-28 13:12 ` Alexander Graf
2021-06-28 16:35 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YL+uDA7zo73A7e1j@work-vm \
--to=dgilbert@redhat.com \
--cc=berrange@redhat.com \
--cc=leobras.c@gmail.com \
--cc=lukasstraub2@web.de \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.