From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
"Markus Armbruster" <armbru@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
peterx@redhat.com, "Juraj Marcin" <jmarcin@redhat.com>
Subject: [PATCH for-11.0 v2 4/7] migration: Make migration_connect_set_error() own the error
Date: Mon, 1 Dec 2025 14:45:07 -0500 [thread overview]
Message-ID: <20251201194510.1121221-5-peterx@redhat.com> (raw)
In-Reply-To: <20251201194510.1121221-1-peterx@redhat.com>
Make migration_connect_set_error() take ownership of the error always.
Paving way for making migrate_set_error() to take ownership.
When at it, renaming it to migration_connect_error_propagate(), following
Error API, to imply the Error object ownership transition.
NOTE: this patch also makes migration_connect() to take ownership of the
Error passed in.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/channel.c | 1 -
migration/migration.c | 9 +++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/migration/channel.c b/migration/channel.c
index 462cc183e1..92435fa7f7 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -95,7 +95,6 @@ void migration_channel_connect(MigrationState *s,
}
}
migration_connect(s, error);
- error_free(error);
}
diff --git a/migration/migration.c b/migration/migration.c
index b316ee01ab..0ff8b31a88 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1575,7 +1575,7 @@ static void migrate_error_free(MigrationState *s)
}
}
-static void migration_connect_set_error(MigrationState *s, const Error *error)
+static void migration_connect_error_propagate(MigrationState *s, Error *error)
{
MigrationStatus current = s->state;
MigrationStatus next;
@@ -1602,6 +1602,7 @@ static void migration_connect_set_error(MigrationState *s, const Error *error)
migrate_set_state(&s->state, current, next);
migrate_set_error(s, error);
+ error_free(error);
}
void migration_cancel(void)
@@ -2292,7 +2293,7 @@ void qmp_migrate(const char *uri, bool has_channels,
out:
if (local_err) {
- migration_connect_set_error(s, local_err);
+ migration_connect_error_propagate(s, error_copy(local_err));
error_propagate(errp, local_err);
}
}
@@ -2337,7 +2338,7 @@ static void qmp_migrate_finish(MigrationAddress *addr, bool resume_requested,
if (!resume_requested) {
yank_unregister_instance(MIGRATION_YANK_INSTANCE);
}
- migration_connect_set_error(s, local_err);
+ migration_connect_error_propagate(s, error_copy(local_err));
error_propagate(errp, local_err);
return;
}
@@ -4039,7 +4040,7 @@ void migration_connect(MigrationState *s, Error *error_in)
s->expected_downtime = migrate_downtime_limit();
if (error_in) {
- migration_connect_set_error(s, error_in);
+ migration_connect_error_propagate(s, error_in);
if (resume) {
/*
* Don't do cleanup for resume if channel is invalid, but only dump
--
2.50.1
next prev parent reply other threads:[~2025-12-01 19:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 19:45 [PATCH for-11.0 v2 0/7] migration: Error reporting cleanups Peter Xu
2025-12-01 19:45 ` [PATCH for-11.0 v2 1/7] migration: Use explicit error_free() instead of g_autoptr Peter Xu
2025-12-01 19:45 ` [PATCH for-11.0 v2 2/7] Revert "error: define g_autoptr() cleanup function for the Error type" Peter Xu
2025-12-02 7:53 ` Cédric Le Goater
2025-12-01 19:45 ` [PATCH for-11.0 v2 3/7] error: Poison g_autoptr(Error) to prevent its use Peter Xu
2025-12-01 19:45 ` Peter Xu [this message]
2025-12-02 11:42 ` [PATCH for-11.0 v2 4/7] migration: Make migration_connect_set_error() own the error Markus Armbruster
2025-12-01 19:45 ` [PATCH for-11.0 v2 5/7] migration: Make multifd_send_set_error() " Peter Xu
2025-12-01 19:45 ` [PATCH for-11.0 v2 6/7] migration: Make multifd_recv_terminate_threads() " Peter Xu
2025-12-02 11:44 ` Markus Armbruster
2025-12-01 19:45 ` [PATCH for-11.0 v2 7/7] migration: Replace migrate_set_error() with migrate_error_propagate() Peter Xu
2025-12-02 11:59 ` Markus Armbruster
2025-12-02 17:28 ` Peter Xu
2025-12-02 13:55 ` [PATCH for-11.0 v2 0/7] migration: Error reporting cleanups Fabiano Rosas
2025-12-02 17:47 ` Peter Xu
2025-12-02 17:53 ` [PATCH for-11.0 v2 8/7] migration: Use error_propagate() in migrate_error_propagate() Peter Xu
2025-12-03 7:38 ` Markus Armbruster
2025-12-03 14:33 ` [PATCH for-11.0 v2 0/7] migration: Error reporting cleanups Peter Xu
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=20251201194510.1121221-5-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@yandex-team.ru \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).