All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Ani Sinha <anisinha@redhat.com>
Cc: Peter Xu <peterx@redhat.com>,  Fabiano Rosas <farosas@suse.de>,
	 Prasad Pandit <pjp@fedoraproject.org>,
	 qemu-devel@nongnu.org
Subject: Re: [PATCH] migration: assert that the same migration handler is not being added twice
Date: Tue, 10 Mar 2026 11:03:34 +0100	[thread overview]
Message-ID: <87wlzkknm1.fsf@pond.sub.org> (raw)
In-Reply-To: <20260308100148.162503-1-anisinha@redhat.com> (Ani Sinha's message of "Sun, 8 Mar 2026 15:31:48 +0530")

Ani Sinha <anisinha@redhat.com> writes:

> Currently the code that adds a migration blocker does not check if the same
> blocker already exists. Assert that the migration handler being added has
> not been added already.
>
> CC: Markus Armbruster <armbru@redhat.com>
> CC: Peter Xu <peterx@redhat.com>
> CC: Prasad Pandit <pjp@fedoraproject.org>
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
>  migration/migration.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index a5b0465ed3..840cf0dfe2 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1702,6 +1702,8 @@ static int add_blockers(Error **reasonp, unsigned modes, Error **errp)
>  {
>      for (MigMode mode = 0; mode < MIG_MODE__MAX; mode++) {
>          if (modes & BIT(mode)) {
> +            assert(g_slist_index(migration_blockers[mode],
> +                                     *reasonp) == -1);

Indentation is off.

Have we run into such extra additions, or is this just out of caution?

What would happen if such an extra addition went uncaught?

>              migration_blockers[mode] = g_slist_prepend(migration_blockers[mode],
>                                                         *reasonp);
>          }



  parent reply	other threads:[~2026-03-10 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-08 10:01 [PATCH] migration: assert that the same migration handler is not being added twice Ani Sinha
2026-03-09 15:39 ` Peter Xu
2026-03-10 10:03 ` Markus Armbruster [this message]
2026-03-10 10:13   ` Ani Sinha

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=87wlzkknm1.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=farosas@suse.de \
    --cc=peterx@redhat.com \
    --cc=pjp@fedoraproject.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.