aboutsummaryrefslogtreecommitdiff
path: root/migration/migration.h
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2018-05-02 18:47:38 +0800
committerJuan Quintela <quintela@redhat.com>2018-05-15 22:12:41 +0200
commit62df066ffffdbd41b42ca91130611e40fbc53f0b (patch)
treeb834f0b0dc36054f7a883be9a3a8e10ea66dec32 /migration/migration.h
parent3b563c4be01f42d2a4e641d50736bd5ac8e3b15f (diff)
downloadqemu-62df066ffffdbd41b42ca91130611e40fbc53f0b.zip
qemu-62df066ffffdbd41b42ca91130611e40fbc53f0b.tar.gz
qemu-62df066ffffdbd41b42ca91130611e40fbc53f0b.tar.bz2
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 <dgilbert@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180502104740.12123-23-peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/migration.h')
-rw-r--r--migration/migration.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/migration/migration.h b/migration/migration.h
index f83f106..8f0c821 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;