mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 09:55:55 +00:00
![Fabiano Rosas](/assets/img/avatar_default.png)
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>
26 lines
713 B
C
26 lines
713 B
C
/*
|
|
* Migration Threads info
|
|
*
|
|
* Copyright (c) 2022 HUAWEI TECHNOLOGIES CO., LTD.
|
|
*
|
|
* Authors:
|
|
* Jiang Jiacheng <jiangjiacheng@huawei.com>
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#include "qapi/error.h"
|
|
#include "qapi/qapi-commands-migration.h"
|
|
|
|
typedef struct MigrationThread MigrationThread;
|
|
|
|
struct MigrationThread {
|
|
const char *name; /* the name of migration thread */
|
|
int thread_id; /* ID of the underlying host thread */
|
|
QLIST_ENTRY(MigrationThread) node;
|
|
};
|
|
|
|
MigrationThread *migration_threads_add(const char *name, int thread_id);
|
|
void migration_threads_remove(MigrationThread *info);
|