migration: add missing qemu_mutex_lock_iothread in migration_completion
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>
Tue, 5 Oct 2021 08:07:51 +0000 (04:07 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 5 Oct 2021 11:10:29 +0000 (13:10 +0200)
qemu_savevm_state_complete_postcopy assumes the iothread lock (BQL)
to be held, but instead it isn't.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20211005080751.3797161-3-eesposit@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
migration/migration.c

index bb909781b7f51a6f50081a248e4301d23787e85a..6ac807ef3dbf496e68014a76a7a35e004ea91c76 100644 (file)
@@ -3168,7 +3168,10 @@ static void migration_completion(MigrationState *s)
     } else if (s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
         trace_migration_completion_postcopy_end();
 
+        qemu_mutex_lock_iothread();
         qemu_savevm_state_complete_postcopy(s->to_dst_file);
+        qemu_mutex_unlock_iothread();
+
         trace_migration_completion_postcopy_end_after_complete();
     } else if (s->state == MIGRATION_STATUS_CANCELLING) {
         goto fail;