From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Li Xiaohui <xiaohli@redhat.com>,
Lukas Straub <lukasstraub2@web.de>,
qemu-devel@nongnu.org,
Leonardo Bras Soares Passos <lsoaresp@redhat.com>,
Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH 3/3] migration: Clear error at entry of migrate_fd_connect()
Date: Mon, 12 Jul 2021 19:40:47 +0100 [thread overview]
Message-ID: <YOyMr1cxQ9PdU5TQ@work-vm> (raw)
In-Reply-To: <20210708190653.252961-4-peterx@redhat.com>
* Peter Xu (peterx@redhat.com) wrote:
> For each "migrate" command, remember to clear the s->error before going on.
> For one reason, when there's a new error it'll be still remembered; see
> migrate_set_error() who only sets the error if error==NULL. Meanwhile if a
> failed migration completes (e.g., postcopy recovered and finished), we
> shouldn't dump an error when calling migrate_fd_cleanup() at last.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> migration/migration.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index bb1edf862a..338df01e97 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1855,6 +1855,15 @@ void migrate_set_error(MigrationState *s, const Error *error)
> }
> }
>
> +static void migrate_error_free(MigrationState *s)
> +{
> + QEMU_LOCK_GUARD(&s->error_mutex);
> + if (s->error) {
> + error_free(s->error);
> + s->error = NULL;
> + }
> +}
> +
> void migrate_fd_error(MigrationState *s, const Error *error)
> {
> trace_migrate_fd_error(error_get_pretty(error));
> @@ -3966,6 +3975,13 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
> int64_t rate_limit;
> bool resume = s->state == MIGRATION_STATUS_POSTCOPY_PAUSED;
>
> + /*
> + * If there's a previous error, free it and prepare for another one.
> + * Meanwhile if migration completes successfully, there won't have an error
> + * dumped when calling migrate_fd_cleanup().
> + */
> + migrate_error_free(s);
> +
> s->expected_downtime = s->parameters.downtime_limit;
> if (resume) {
> assert(s->cleanup_bh);
> --
> 2.31.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2021-07-12 18:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-08 19:06 [PATCH 0/3] migration: Three more fixes for postcopy recovery Peter Xu
2021-07-08 19:06 ` [PATCH 1/3] migration: Release return path early for paused postcopy Peter Xu
2021-07-08 19:13 ` Peter Xu
2021-07-12 17:44 ` Dr. David Alan Gilbert
2021-07-08 19:06 ` [PATCH 2/3] migration: Don't do migrate cleanup if during postcopy resume Peter Xu
2021-07-12 18:33 ` Dr. David Alan Gilbert
2021-07-08 19:06 ` [PATCH 3/3] migration: Clear error at entry of migrate_fd_connect() Peter Xu
2021-07-12 18:40 ` Dr. David Alan Gilbert [this message]
2021-07-13 11:04 ` [PATCH 0/3] migration: Three more fixes for postcopy recovery Dr. David Alan Gilbert
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=YOyMr1cxQ9PdU5TQ@work-vm \
--to=dgilbert@redhat.com \
--cc=lsoaresp@redhat.com \
--cc=lukasstraub2@web.de \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=xiaohli@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 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).