From: Juan Quintela <quintela@redhat.com>
To: Rao Lei <lei.rao@intel.com>
Cc: chen.zhang@intel.com, zhanghailiang@xfusion.com,
dgilbert@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH] migration/colo.c: Add missed return in error handling
Date: Wed, 26 Jan 2022 21:51:06 +0100 [thread overview]
Message-ID: <87r18unrut.fsf@secure.mitica> (raw)
In-Reply-To: <20211228073517.88193-1-lei.rao@intel.com> (Rao Lei's message of "Tue, 28 Dec 2021 15:35:17 +0800")
Rao Lei <lei.rao@intel.com> wrote:
> When doing failover and checkpoint, some returns are missed in error
> handling. Let's add it.
>
> Signed-off-by: Lei Rao <lei.rao@intel.com>
> ---
> migration/colo.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/migration/colo.c b/migration/colo.c
> index 5f7071b3cd..014d3cba01 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -94,12 +94,15 @@ static void secondary_vm_do_failover(void)
> if (local_err) {
> error_report_err(local_err);
> local_err = NULL;
> + return;
Assign a local variable before a return is a NOP, so remove the assignmenent?
> }
>
> /* Notify all filters of all NIC to do checkpoint */
> colo_notify_filters_event(COLO_EVENT_FAILOVER, &local_err);
> if (local_err) {
> error_report_err(local_err);
> + local_err = NULL;
> + return;
Same here.
> }
>
> if (!autostart) {
> @@ -178,6 +181,7 @@ static void primary_vm_do_failover(void)
> if (local_err) {
> error_report_err(local_err);
> local_err = NULL;
> + return;
And here.
> }
>
> /* Notify COLO thread that failover work is finished */
> @@ -507,12 +511,11 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
> goto out;
> }
>
> - ret = 0;
> -
> qemu_mutex_lock_iothread();
> vm_start();
> qemu_mutex_unlock_iothread();
> trace_colo_vm_state_change("stop", "run");
> + return 0;
>
> out:
> if (local_err) {
This is really a NOP, but it is one line less, so I will not complain.
But ther, it is better to just rename the label from "out" to "error" or
something like that.
Later, Juan.
prev parent reply other threads:[~2022-01-26 20:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-28 7:35 [PATCH] migration/colo.c: Add missed return in error handling Rao Lei
2021-12-29 1:12 ` Zhang, Chen
2022-01-26 20:51 ` Juan Quintela [this message]
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=87r18unrut.fsf@secure.mitica \
--to=quintela@redhat.com \
--cc=chen.zhang@intel.com \
--cc=dgilbert@redhat.com \
--cc=lei.rao@intel.com \
--cc=qemu-devel@nongnu.org \
--cc=zhanghailiang@xfusion.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).