migration: assert that the same migration handler is not being added twice
PATCH 1/1 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.
--- migration/migration.c | 2 ++ 1 file changed, 2 insertions(+)
migration/migration.c +2 -0
@@ -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); }
Signature · 1 line
2.52.0
Quoted 8 lines · Ani Sinha
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]>
Signature · 1 line
Peter Xu
Quoted 17 lines · Ani Sinha
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(+)migration/migration.c +0
-0
migration/migration.c static int add_blockers(Error **reasonp, unsigned modes, Error **errp) · line 1706
Quoted 5 lines
migration/migration.c +2
-0@@ -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?
Quoted 3 lines
migration/migration.c +0
-0migration_blockers[mode] =g_slist_prepend (migration_blockers[mode], *reasonp); }
Quoted 31 lines · Markus Armbruster
Quoted 17 lines · Ani Sinha
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(+)migration/migration.c +0
-0migration/migration.c static int add_blockers(Error **reasonp, unsigned modes, Error **errp) · line 1706
Quoted 5 lines
migration/migration.c +2
-0@@ -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.
Quoted 1 line
Have we run into such extra additions, or is this just out of caution?
Out of caution I suspect.
Quoted 5 lines
What would happen if such an extra addition went uncaught?
Quoted 2 lines
migration/migration.c +0
-0migration_blockers[mode] =g_slist_prepend (migration_blockers[mode], *reasonp);
I vaguely recall multiple blockers causing some crash.
Quoted 1 line
Quoted 1 line
migration/migration.c +0
-0}