summaryrefslogtreecommitdiffstats
path: root/migration/block-dirty-bitmap.c
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito2021-10-05 10:07:50 +0200
committerPaolo Bonzini2021-10-05 13:10:29 +0200
commit3c158eba1e11e52dbd0e14fc8fd40ec80abca436 (patch)
tree7934abf51cbb7332c48d18e0b0240dcbef4ef3a6 /migration/block-dirty-bitmap.c
parentconfigure, meson: move CPU_CFLAGS out of QEMU_CFLAGS (diff)
downloadqemu-3c158eba1e11e52dbd0e14fc8fd40ec80abca436.tar.gz
qemu-3c158eba1e11e52dbd0e14fc8fd40ec80abca436.tar.xz
qemu-3c158eba1e11e52dbd0e14fc8fd40ec80abca436.zip
migration: block-dirty-bitmap: add missing qemu_mutex_lock_iothread
init_dirty_bitmap_migration assumes the iothread lock (BQL) to be held, but instead it isn't. Instead of adding the lock to qemu_savevm_state_setup(), follow the same pattern as the other ->save_setup callbacks and lock+unlock inside dirty_bitmap_save_setup(). Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20211005080751.3797161-2-eesposit@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'migration/block-dirty-bitmap.c')
-rw-r--r--migration/block-dirty-bitmap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 35f5ef688d..9aba7d9c22 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -1215,7 +1215,10 @@ static int dirty_bitmap_save_setup(QEMUFile *f, void *opaque)
{
DBMSaveState *s = &((DBMState *)opaque)->save;
SaveBitmapState *dbms = NULL;
+
+ qemu_mutex_lock_iothread();
if (init_dirty_bitmap_migration(s) < 0) {
+ qemu_mutex_unlock_iothread();
return -1;
}
@@ -1223,7 +1226,7 @@ static int dirty_bitmap_save_setup(QEMUFile *f, void *opaque)
send_bitmap_start(f, s, dbms);
}
qemu_put_bitmap_flags(f, DIRTY_BITMAP_MIG_FLAG_EOS);
-
+ qemu_mutex_unlock_iothread();
return 0;
}