|
|
a83cc2 |
From a722ec5614bbaa36992653250add7dabd39b12ad Mon Sep 17 00:00:00 2001
|
|
|
a83cc2 |
From: Leonardo Bras <leobras.c@gmail.com>
|
|
|
a83cc2 |
Date: Tue, 1 Jun 2021 02:40:31 -0300
|
|
|
a83cc2 |
Subject: [PATCH 01/21] yank: Unregister function when using TLS migration
|
|
|
a83cc2 |
MIME-Version: 1.0
|
|
|
a83cc2 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a83cc2 |
Content-Transfer-Encoding: 8bit
|
|
|
a83cc2 |
|
|
|
a83cc2 |
RH-Author: Leonardo BrĂ¡s <leobras@redhat.com>
|
|
|
a83cc2 |
RH-MergeRequest: 10: yank: Unregister function when using TLS migration
|
|
|
a83cc2 |
RH-Commit: [1/1] b39e19a3a92dc7f881527198824ce7f402aa9289 (LeoBras/centos-qemu-kvm)
|
|
|
a83cc2 |
RH-Bugzilla: 1972462
|
|
|
a83cc2 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
a83cc2 |
RH-Acked-by: Peter Xu <Peter Xu <peterx@redhat.com>>
|
|
|
a83cc2 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
a83cc2 |
|
|
|
a83cc2 |
After yank feature was introduced in migration, whenever migration
|
|
|
a83cc2 |
is started using TLS, the following error happens in both source and
|
|
|
a83cc2 |
destination hosts:
|
|
|
a83cc2 |
|
|
|
a83cc2 |
(qemu) qemu-kvm: ../util/yank.c:107: yank_unregister_instance:
|
|
|
a83cc2 |
Assertion `QLIST_EMPTY(&entry->yankfns)' failed.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
This happens because of a missing yank_unregister_function() when using
|
|
|
a83cc2 |
qio-channel-tls.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Fix this by also allowing TYPE_QIO_CHANNEL_TLS object type to perform
|
|
|
a83cc2 |
yank_unregister_function() in channel_close() and multifd_load_cleanup().
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Also, inside migration_channel_connect() and
|
|
|
a83cc2 |
migration_channel_process_incoming() move yank_register_function() so
|
|
|
a83cc2 |
it only runs once on a TLS migration.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Fixes: b5eea99ec2f ("migration: Add yank feature", 2021-01-13)
|
|
|
a83cc2 |
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1964326
|
|
|
a83cc2 |
Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
|
|
|
a83cc2 |
Reviewed-by: Lukas Straub <lukasstraub2@web.de>
|
|
|
a83cc2 |
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
|
a83cc2 |
Message-Id: <20210601054030.1153249-1-leobras.c@gmail.com>
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
a83cc2 |
(cherry picked from commit 7de2e8565335c13fb3516cddbe2e40e366cce273)
|
|
|
a83cc2 |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
a83cc2 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
a83cc2 |
---
|
|
|
a83cc2 |
migration/channel.c | 26 ++++++++++++++------------
|
|
|
a83cc2 |
migration/multifd.c | 3 ++-
|
|
|
a83cc2 |
migration/qemu-file-channel.c | 4 +++-
|
|
|
a83cc2 |
3 files changed, 19 insertions(+), 14 deletions(-)
|
|
|
a83cc2 |
|
|
|
a83cc2 |
diff --git a/migration/channel.c b/migration/channel.c
|
|
|
a83cc2 |
index c9ee902021..01275a9162 100644
|
|
|
a83cc2 |
--- a/migration/channel.c
|
|
|
a83cc2 |
+++ b/migration/channel.c
|
|
|
a83cc2 |
@@ -38,18 +38,19 @@ void migration_channel_process_incoming(QIOChannel *ioc)
|
|
|
a83cc2 |
trace_migration_set_incoming_channel(
|
|
|
a83cc2 |
ioc, object_get_typename(OBJECT(ioc)));
|
|
|
a83cc2 |
|
|
|
a83cc2 |
- if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) {
|
|
|
a83cc2 |
- yank_register_function(MIGRATION_YANK_INSTANCE,
|
|
|
a83cc2 |
- migration_yank_iochannel,
|
|
|
a83cc2 |
- QIO_CHANNEL(ioc));
|
|
|
a83cc2 |
- }
|
|
|
a83cc2 |
-
|
|
|
a83cc2 |
if (s->parameters.tls_creds &&
|
|
|
a83cc2 |
*s->parameters.tls_creds &&
|
|
|
a83cc2 |
!object_dynamic_cast(OBJECT(ioc),
|
|
|
a83cc2 |
TYPE_QIO_CHANNEL_TLS)) {
|
|
|
a83cc2 |
migration_tls_channel_process_incoming(s, ioc, &local_err);
|
|
|
a83cc2 |
} else {
|
|
|
a83cc2 |
+ if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) ||
|
|
|
a83cc2 |
+ object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) {
|
|
|
a83cc2 |
+ yank_register_function(MIGRATION_YANK_INSTANCE,
|
|
|
a83cc2 |
+ migration_yank_iochannel,
|
|
|
a83cc2 |
+ QIO_CHANNEL(ioc));
|
|
|
a83cc2 |
+ }
|
|
|
a83cc2 |
+
|
|
|
a83cc2 |
migration_ioc_process_incoming(ioc, &local_err);
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
|
|
|
a83cc2 |
@@ -76,12 +77,6 @@ void migration_channel_connect(MigrationState *s,
|
|
|
a83cc2 |
ioc, object_get_typename(OBJECT(ioc)), hostname, error);
|
|
|
a83cc2 |
|
|
|
a83cc2 |
if (!error) {
|
|
|
a83cc2 |
- if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) {
|
|
|
a83cc2 |
- yank_register_function(MIGRATION_YANK_INSTANCE,
|
|
|
a83cc2 |
- migration_yank_iochannel,
|
|
|
a83cc2 |
- QIO_CHANNEL(ioc));
|
|
|
a83cc2 |
- }
|
|
|
a83cc2 |
-
|
|
|
a83cc2 |
if (s->parameters.tls_creds &&
|
|
|
a83cc2 |
*s->parameters.tls_creds &&
|
|
|
a83cc2 |
!object_dynamic_cast(OBJECT(ioc),
|
|
|
a83cc2 |
@@ -99,6 +94,13 @@ void migration_channel_connect(MigrationState *s,
|
|
|
a83cc2 |
} else {
|
|
|
a83cc2 |
QEMUFile *f = qemu_fopen_channel_output(ioc);
|
|
|
a83cc2 |
|
|
|
a83cc2 |
+ if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) ||
|
|
|
a83cc2 |
+ object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) {
|
|
|
a83cc2 |
+ yank_register_function(MIGRATION_YANK_INSTANCE,
|
|
|
a83cc2 |
+ migration_yank_iochannel,
|
|
|
a83cc2 |
+ QIO_CHANNEL(ioc));
|
|
|
a83cc2 |
+ }
|
|
|
a83cc2 |
+
|
|
|
a83cc2 |
qemu_mutex_lock(&s->qemu_file_lock);
|
|
|
a83cc2 |
s->to_dst_file = f;
|
|
|
a83cc2 |
qemu_mutex_unlock(&s->qemu_file_lock);
|
|
|
a83cc2 |
diff --git a/migration/multifd.c b/migration/multifd.c
|
|
|
a83cc2 |
index a6677c45c8..a8dedcf822 100644
|
|
|
a83cc2 |
--- a/migration/multifd.c
|
|
|
a83cc2 |
+++ b/migration/multifd.c
|
|
|
a83cc2 |
@@ -987,7 +987,8 @@ int multifd_load_cleanup(Error **errp)
|
|
|
a83cc2 |
for (i = 0; i < migrate_multifd_channels(); i++) {
|
|
|
a83cc2 |
MultiFDRecvParams *p = &multifd_recv_state->params[i];
|
|
|
a83cc2 |
|
|
|
a83cc2 |
- if (object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_SOCKET)
|
|
|
a83cc2 |
+ if ((object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_SOCKET) ||
|
|
|
a83cc2 |
+ object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_TLS))
|
|
|
a83cc2 |
&& OBJECT(p->c)->ref == 1) {
|
|
|
a83cc2 |
yank_unregister_function(MIGRATION_YANK_INSTANCE,
|
|
|
a83cc2 |
migration_yank_iochannel,
|
|
|
a83cc2 |
diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
|
|
|
a83cc2 |
index 876d05a540..fad340ea7a 100644
|
|
|
a83cc2 |
--- a/migration/qemu-file-channel.c
|
|
|
a83cc2 |
+++ b/migration/qemu-file-channel.c
|
|
|
a83cc2 |
@@ -26,6 +26,7 @@
|
|
|
a83cc2 |
#include "qemu-file-channel.h"
|
|
|
a83cc2 |
#include "qemu-file.h"
|
|
|
a83cc2 |
#include "io/channel-socket.h"
|
|
|
a83cc2 |
+#include "io/channel-tls.h"
|
|
|
a83cc2 |
#include "qemu/iov.h"
|
|
|
a83cc2 |
#include "qemu/yank.h"
|
|
|
a83cc2 |
#include "yank_functions.h"
|
|
|
a83cc2 |
@@ -106,7 +107,8 @@ static int channel_close(void *opaque, Error **errp)
|
|
|
a83cc2 |
int ret;
|
|
|
a83cc2 |
QIOChannel *ioc = QIO_CHANNEL(opaque);
|
|
|
a83cc2 |
ret = qio_channel_close(ioc, errp);
|
|
|
a83cc2 |
- if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)
|
|
|
a83cc2 |
+ if ((object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) ||
|
|
|
a83cc2 |
+ object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS))
|
|
|
a83cc2 |
&& OBJECT(ioc)->ref == 1) {
|
|
|
a83cc2 |
yank_unregister_function(MIGRATION_YANK_INSTANCE,
|
|
|
a83cc2 |
migration_yank_iochannel,
|
|
|
a83cc2 |
--
|
|
|
a83cc2 |
2.27.0
|
|
|
a83cc2 |
|