From 62df066ffffdbd41b42ca91130611e40fbc53f0b Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Wed, 2 May 2018 18:47:38 +0800 Subject: migration: introduce lock for to_dst_file Let's introduce a lock for that QEMUFile since we are going to operate on it in multiple threads. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20180502104740.12123-23-peterx@redhat.com> Signed-off-by: Juan Quintela --- migration/migration.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'migration/migration.h') diff --git a/migration/migration.h b/migration/migration.h index f83f1064b5..8f0c82159b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -114,6 +114,12 @@ struct MigrationState QemuThread thread; QEMUBH *cleanup_bh; QEMUFile *to_dst_file; + /* + * Protects to_dst_file pointer. We need to make sure we won't + * yield or hang during the critical section, since this lock will + * be used in OOB command handler. + */ + QemuMutex qemu_file_lock; /* bytes already send at the beggining of current interation */ uint64_t iteration_initial_bytes; -- cgit v1.2.3