* [PATCH] migration: assert that the same migration handler is not being added twice
@ 2026-03-08 10:01 Ani Sinha
2026-03-09 15:39 ` Peter Xu
2026-03-10 10:03 ` Markus Armbruster
0 siblings, 2 replies; 4+ messages in thread
From: Ani Sinha @ 2026-03-08 10:01 UTC (permalink / raw)
To: Peter Xu, Fabiano Rosas
Cc: Ani Sinha, Markus Armbruster, Prasad Pandit, qemu-devel
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);
migration_blockers[mode] = g_slist_prepend(migration_blockers[mode],
*reasonp);
}
--
2.52.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] migration: assert that the same migration handler is not being added twice
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
1 sibling, 0 replies; 4+ messages in thread
From: Peter Xu @ 2026-03-09 15:39 UTC (permalink / raw)
To: Ani Sinha; +Cc: Fabiano Rosas, Markus Armbruster, Prasad Pandit, qemu-devel
On Sun, Mar 08, 2026 at 03:31:48PM +0530, Ani Sinha wrote:
> 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>
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] migration: assert that the same migration handler is not being added twice
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
2026-03-10 10:13 ` Ani Sinha
1 sibling, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2026-03-10 10:03 UTC (permalink / raw)
To: Ani Sinha; +Cc: Peter Xu, Fabiano Rosas, Prasad Pandit, qemu-devel
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);
> }
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] migration: assert that the same migration handler is not being added twice
2026-03-10 10:03 ` Markus Armbruster
@ 2026-03-10 10:13 ` Ani Sinha
0 siblings, 0 replies; 4+ messages in thread
From: Ani Sinha @ 2026-03-10 10:13 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Peter Xu, Fabiano Rosas, Prasad Pandit, qemu-devel
> On 10 Mar 2026, at 3:33 PM, Markus Armbruster <armbru@redhat.com> wrote:
>
> 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?
Out of caution I suspect.
>
> What would happen if such an extra addition went uncaught?
>
>> migration_blockers[mode] = g_slist_prepend(migration_blockers[mode],
>> *reasonp);
I vaguely recall multiple blockers causing some crash.
>> }
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-10 10:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-03-10 10:13 ` Ani Sinha
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.