@samitouri / QOSamiQemu / commits / 22b0179639

migration: assert that the same migration handler is not being added twice

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> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Ani Sinha <anisinha@redhat.com> Link: https://lore.kernel.org/qemu-devel/20260311070114.164434-1-anisinha@redhat.com Signed-off-by: Fabiano Rosas <farosas@suse.de>

Ani Sinha committed Mar 11, 2026 at 12:31 UTC 22b01796396e182fd1ad7e5480f07510ceef39f8
1 file changed +2
migration/migration.c
+2
@@ -1699,6 +1699,8 @@ static int add_blockers(Error **reasonp, unsigned modes, Error **errp)
1699 {
1700 for (MigMode mode = 0; mode < MIG_MODE__MAX; mode++) {
1701 if (modes & BIT(mode)) {
1702 + assert(g_slist_index(migration_blockers[mode],
1703 + *reasonp) == -1);
1704 migration_blockers[mode] = g_slist_prepend(migration_blockers[mode],
1705 *reasonp);
1706 }