]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/extra/0010-migration-block-dirty-bitmap-fix-loading-bitmap-when.patch
bb01ced55e71fabb264622494f137a2c687b8622
[pve-qemu.git] / debian / patches / extra / 0010-migration-block-dirty-bitmap-fix-loading-bitmap-when.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Fiona Ebner <f.ebner@proxmox.com>
3 Date: Fri, 28 Jul 2023 10:47:48 +0200
4 Subject: [PATCH] migration/block-dirty-bitmap: fix loading bitmap when there
5 is an iothread
6
7 The bdrv_create_dirty_bitmap() function (which is also called by
8 bdrv_dirty_bitmap_create_successor()) uses bdrv_getlength(bs). This is
9 a wrapper around a coroutine, and thus uses bdrv_poll_co(). Polling
10 tries to release the AioContext which will trigger an assert() if it
11 hasn't been acquired before.
12
13 The issue does not happen for migration, because there we are in a
14 coroutine already, so the wrapper will just call bdrv_co_getlength()
15 directly without polling.
16
17 Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
18 ---
19 migration/block-dirty-bitmap.c | 6 ++++++
20 1 file changed, 6 insertions(+)
21
22 diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
23 index fe73aa94b1..7eaf498439 100644
24 --- a/migration/block-dirty-bitmap.c
25 +++ b/migration/block-dirty-bitmap.c
26 @@ -805,8 +805,11 @@ static int dirty_bitmap_load_start(QEMUFile *f, DBMLoadState *s)
27 "destination", bdrv_dirty_bitmap_name(s->bitmap));
28 return -EINVAL;
29 } else {
30 + AioContext *ctx = bdrv_get_aio_context(s->bs);
31 + aio_context_acquire(ctx);
32 s->bitmap = bdrv_create_dirty_bitmap(s->bs, granularity,
33 s->bitmap_name, &local_err);
34 + aio_context_release(ctx);
35 if (!s->bitmap) {
36 error_report_err(local_err);
37 return -EINVAL;
38 @@ -833,7 +836,10 @@ static int dirty_bitmap_load_start(QEMUFile *f, DBMLoadState *s)
39
40 bdrv_disable_dirty_bitmap(s->bitmap);
41 if (flags & DIRTY_BITMAP_MIG_START_FLAG_ENABLED) {
42 + AioContext *ctx = bdrv_get_aio_context(s->bs);
43 + aio_context_acquire(ctx);
44 bdrv_dirty_bitmap_create_successor(s->bitmap, &local_err);
45 + aio_context_release(ctx);
46 if (local_err) {
47 error_report_err(local_err);
48 return -EINVAL;