qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: qemu-devel@nongnu.org
Cc: den@openvz.org,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 1/1] block: fix libvirt snapshot with existing bitmaps
Date: Mon, 13 Jun 2016 15:38:55 +0300	[thread overview]
Message-ID: <1465821535-6664-1-git-send-email-den@openvz.org> (raw)

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Fix the following bug:

 # virsh start test
 Domain test started

 #  virsh qemu-monitor-command test \
     '{"execute":"block-dirty-bitmap-add",\
      "arguments":{"node":"drive0","name":"ab"}}'
 {"return":{},"id":"libvirt-36"}'}'

 # virsh snapshot-create test
 error: Unable to read from monitor: Connection reset by peer

Actually, assert "assert(pos < hb->size)" in hbitmap_iter_init fires,
because qcow2_save_vmstate just writes to bs (not to bs->file->bs) after
the end of the drive.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
---
 block/dirty-bitmap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 4902ca5..7b636ee 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -364,6 +364,11 @@ void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector,
                     int nr_sectors)
 {
     BdrvDirtyBitmap *bitmap;
+
+    if (cur_sector >= bdrv_nb_sectors(bs)) {
+        return;
+    }
+
     QLIST_FOREACH(bitmap, &bs->dirty_bitmaps, list) {
         if (!bdrv_dirty_bitmap_enabled(bitmap)) {
             continue;
-- 
2.1.4

             reply	other threads:[~2016-06-13 12:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 12:38 Denis V. Lunev [this message]
2016-06-14 14:12 ` [Qemu-devel] [PATCH 1/1] block: fix libvirt snapshot with existing bitmaps Max Reitz

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=1465821535-6664-1-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.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;
as well as URLs for NNTP newsgroup(s).