Commit 604492a991 for qemu.org

commit 604492a991ee74a910d40ef94482f1d489ae249b
Author: Lukas Straub <lukasstraub2@web.de>
Date:   Mon Mar 2 12:45:26 2026 +0100

    colo: Hold the BQL while sending ram state

    qemu_savevm_state_complete_precopy() requires that BQL is held.

    This fixes a crash when running with TCG accel.

    Reviewed-by: Peter Xu <peterx@redhat.com>
    Signed-off-by: Lukas Straub <lukasstraub2@web.de>
    Link: https://lore.kernel.org/qemu-devel/20260302-colo_unit_test_multifd-v11-11-d653fb3b1d80@web.de
    Signed-off-by: Fabiano Rosas <farosas@suse.de>

diff --git a/migration/colo.c b/migration/colo.c
index dc7cfa81ef..3297aa593c 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -455,9 +455,8 @@ static int colo_do_checkpoint_transaction(MigrationState *s,

     /* Note: device state is saved into buffer */
     ret = qemu_save_device_state(fb, &local_err);
-
-    bql_unlock();
     if (ret < 0) {
+        bql_unlock();
         goto out;
     }

@@ -471,6 +470,7 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
      */
     qemu_savevm_state_complete_precopy_iterable(s->to_dst_file, false);
     qemu_savevm_state_end(s->to_dst_file);
+    bql_unlock();

     /*
      * We need the size of the VMstate data in Secondary side,