migration/multifd: Protect accesses to migration_threads
authorFabiano Rosas <farosas@suse.de>
Wed, 7 Jun 2023 16:13:05 +0000 (13:13 -0300)
committerJuan Quintela <quintela@redhat.com>
Wed, 26 Jul 2023 08:55:56 +0000 (10:55 +0200)
commit01ec0f3a9211cf4af88706188865b15ad53f7d76
treeacac079fdf4eaef2624ab255868f742e207f6f8f
parent788fa680419854db44205ec6e74602b5f91ee98d
migration/multifd: Protect accesses to migration_threads

This doubly linked list is common for all the multifd and migration
threads so we need to avoid concurrent access.

Add a mutex to protect the data from concurrent access. This fixes a
crash when removing two MigrationThread objects from the list at the
same time during cleanup of multifd threads.

Fixes: 671326201d ("migration: Introduce interface query-migrationthreads")
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20230607161306.31425-3-farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration/threadinfo.c
migration/threadinfo.h