From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu 1/4] migration/block-dirty-bitmap: fix larger granularity bitmaps
Date: Thu, 22 Oct 2020 17:34:17 +0200 [thread overview]
Message-ID: <20201022153420.16971-2-s.reiter@proxmox.com> (raw)
In-Reply-To: <20201022153420.16971-1-s.reiter@proxmox.com>
sectors_per_chunk is a 64 bit integer, but the calculation would be done
in 32 bits, leading to an overflow for coarse bitmap granularities.
If that results in the value 0, it leads to a hang where no progress is
made but send_bitmap_bits is constantly called with nr_sectors being 0.
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
See also this thread for the upstream discussion:
https://lists.gnu.org/archive/html/qemu-devel/2020-10/msg06145.html
migration/block-dirty-bitmap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 784330ebe1..5bf0d9fbc6 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -334,8 +334,9 @@ static int add_bitmaps_to_list(DBMSaveState *s, BlockDriverState *bs,
dbms->node_name = bs_name;
dbms->bitmap = bitmap;
dbms->total_sectors = bdrv_nb_sectors(bs);
- dbms->sectors_per_chunk = CHUNK_SIZE * 8 *
+ dbms->sectors_per_chunk = CHUNK_SIZE * 8LLU *
bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS;
+ assert(dbms->sectors_per_chunk != 0);
if (bdrv_dirty_bitmap_enabled(bitmap)) {
dbms->flags |= DIRTY_BITMAP_MIG_START_FLAG_ENABLED;
}
--
2.20.1
next prev parent reply other threads:[~2020-10-22 15:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 15:34 [pve-devel] [PATCH 0/4] Keep dirty-bitmaps for PBS during migration Stefan Reiter
2020-10-22 15:34 ` Stefan Reiter [this message]
2020-10-22 15:34 ` [pve-devel] [PATCH qemu 2/4] PVE: Migrate dirty bitmap state via savevm Stefan Reiter
2020-10-22 15:34 ` [pve-devel] [PATCH proxmox-backup-qemu 3/4] add state serializing and loading functions Stefan Reiter
2020-10-28 21:51 ` [pve-devel] applied: " Thomas Lamprecht
2020-10-22 15:34 ` [pve-devel] [PATCH qemu-server 4/4] migrate: enable dirty-bitmap migration Stefan Reiter
2020-10-29 18:13 ` [pve-devel] applied-series: [PATCH 0/4] Keep dirty-bitmaps for PBS during migration Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201022153420.16971-2-s.reiter@proxmox.com \
--to=s.reiter@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox