[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/19] migration: Move yank outside qemu_start_incoming_migration(
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 03/19] migration: Move yank outside qemu_start_incoming_migration() |
Date: |
Mon, 5 Jul 2021 11:02:19 +0100 |
From: Peter Xu <peterx@redhat.com>
Starting from commit b5eea99ec2f5c, qmp_migrate_recover() calls unregister
before calling qemu_start_incoming_migration(). I believe it wanted to mitigate
the next call to yank_register_instance(), but I think that's wrong.
Firstly, if during recover, we should keep the yank instance there, not
"quickly removing and adding it back".
Meanwhile, calling qmp_migrate_recover() twice with b5eea99ec2f5c will directly
crash the dest qemu (right now it can't; but it'll start to work right after
the next patch) because the 1st call of qmp_migrate_recover() will unregister
permanently when the channel failed to establish, then the 2nd call of
qmp_migrate_recover() crashes at yank_unregister_instance().
This patch fixes it by moving yank ops out of qemu_start_incoming_migration()
into qmp_migrate_incoming. For qmp_migrate_recover(), drop the unregister of
yank instance too since we keep it there during the recovery phase.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20210629181356.217312-2-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 4228635d18..1bb03d1eca 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -456,10 +456,6 @@ static void qemu_start_incoming_migration(const char *uri,
Error **errp)
{
const char *p = NULL;
- if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) {
- return;
- }
-
qapi_event_send_migration(MIGRATION_STATUS_SETUP);
if (strstart(uri, "tcp:", &p) ||
strstart(uri, "unix:", NULL) ||
@@ -474,7 +470,6 @@ static void qemu_start_incoming_migration(const char *uri,
Error **errp)
} else if (strstart(uri, "fd:", &p)) {
fd_start_incoming_migration(p, errp);
} else {
- yank_unregister_instance(MIGRATION_YANK_INSTANCE);
error_setg(errp, "unknown migration protocol: %s", uri);
}
}
@@ -2083,9 +2078,14 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
return;
}
+ if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) {
+ return;
+ }
+
qemu_start_incoming_migration(uri, &local_err);
if (local_err) {
+ yank_unregister_instance(MIGRATION_YANK_INSTANCE);
error_propagate(errp, local_err);
return;
}
@@ -2114,7 +2114,6 @@ void qmp_migrate_recover(const char *uri, Error **errp)
* only re-setup the migration stream and poke existing migration
* to continue using that newly established channel.
*/
- yank_unregister_instance(MIGRATION_YANK_INSTANCE);
qemu_start_incoming_migration(uri, errp);
}
--
2.31.1
- [PULL v2 00/19] migration queue, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 01/19] tests: migration-test: Add dirty ring test, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 02/19] migration: fix the memory overwriting risk in add_to_iovec, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 03/19] migration: Move yank outside qemu_start_incoming_migration(),
Dr. David Alan Gilbert (git) <=
- [PULL 04/19] migration: Allow reset of postcopy_recover_triggered when failed, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 06/19] migration: failover: continue to wait card unplug on error, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 05/19] migration: move wait-unplug loop to its own function, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 07/19] virtiofsd: use GDateTime for formatting timestamp for debug messages, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 08/19] docs: describe the security considerations with virtiofsd xattr mapping, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 09/19] virtiofsd: Don't allow file creation with FUSE_OPEN, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 10/19] virtiofsd: Fix fuse setxattr() API change issue, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 11/19] virtiofsd: Fix xattr operations overwriting errno, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 12/19] virtiofsd: Add support for extended setxattr, Dr. David Alan Gilbert (git), 2021/07/05
- [PULL 13/19] virtiofsd: Add umask to seccom allow list, Dr. David Alan Gilbert (git), 2021/07/05