> On 10 Mar 2026, at 3:33 PM, Markus Armbruster <[email protected]> wrote:
> 
> Ani Sinha <[email protected]> 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 <[email protected]>
>> CC: Peter Xu <[email protected]>
>> CC: Prasad Pandit <[email protected]>
>> Signed-off-by: Ani Sinha <[email protected]>
>> ---
>> 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.


>>         }



Reply via email to