[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] migration: Take reference to migration state around bg_migra
|
From: |
Fabiano Rosas |
|
Subject: |
[PATCH 2/5] migration: Take reference to migration state around bg_migration_vm_start_bh |
|
Date: |
Fri, 19 Jan 2024 20:39:19 -0300 |
We need to hold a reference to the current_migration object around
async calls to avoid it been freed while still in use.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/migration.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/migration/migration.c b/migration/migration.c
index cf17b68e57..b1213b59ce 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3382,6 +3382,7 @@ static void bg_migration_vm_start_bh(void *opaque)
vm_resume(s->vm_old_state);
migration_downtime_end(s);
+ object_unref(OBJECT(s));
}
/**
@@ -3486,6 +3487,7 @@ static void *bg_migration_thread(void *opaque)
* writes to virtio VQs memory which is in write-protected region.
*/
s->vm_start_bh = qemu_bh_new(bg_migration_vm_start_bh, s);
+ object_ref(OBJECT(s));
qemu_bh_schedule(s->vm_start_bh);
bql_unlock();
--
2.35.3
[PATCH 5/5] migration: Centralize BH creation and dispatch, Fabiano Rosas, 2024/01/19
[PATCH 4/5] migration: Add a wrapper to qemu_bh_schedule, Fabiano Rosas, 2024/01/19
Re: [PATCH 0/5] migration: Fix migration state reference counting, Peter Xu, 2024/01/22