aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-02-15 19:57:57 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-02-16 15:34:43 +0100
commit4987783400667147ada01a5bdcce53f11b822888 (patch)
tree5c52e9b632ac7e379e402dee41bbd62438a8e4d9
parent98799b0d4be4fb5e3962005448119133a6bf74b2 (diff)
downloadqemu-4987783400667147ada01a5bdcce53f11b822888.zip
qemu-4987783400667147ada01a5bdcce53f11b822888.tar.gz
qemu-4987783400667147ada01a5bdcce53f11b822888.tar.bz2
migration: fix incorrect memory_global_dirty_log_start outside BQL
This can cause various segmentation faults or aborts in qemu-iotests test 091. Fixes: 5b82b703b69acc67b78b98a5efc897a3912719eb Cc: Dave Gilbert <dgilbert@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--migration/ram.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 96c749f..704f6a9 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1920,6 +1920,9 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
acct_clear();
}
+ /* For memory_global_dirty_log_start below. */
+ qemu_mutex_lock_iothread();
+
qemu_mutex_lock_ramlist();
rcu_read_lock();
bytes_transferred = 0;
@@ -1944,6 +1947,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
memory_global_dirty_log_start();
migration_bitmap_sync();
qemu_mutex_unlock_ramlist();
+ qemu_mutex_unlock_iothread();
qemu_put_be64(f, ram_bytes_total() | RAM_SAVE_FLAG_MEM_SIZE);