qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, eblake@redhat.com,
	jsnow@redhat.com, vsementsov@virtuozzo.com, den@openvz.org,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH for-2.11 3/3] block: Error out on load_vm with active dirty bitmaps
Date: Mon, 20 Nov 2017 15:50:06 +0100	[thread overview]
Message-ID: <20171120145006.551-4-kwolf@redhat.com> (raw)
In-Reply-To: <20171120145006.551-1-kwolf@redhat.com>

Loading a snapshot invalidates the bitmap. Just marking all blocks dirty
is not a useful response in practice, instead the user needs to be aware
that we switch to a completely different state. If they are okay with
losing the dirty bitmap, they can just explicitly delete it.

This effectively reverts commit 04dec3c3ae5.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/snapshot.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/block/snapshot.c b/block/snapshot.c
index 13ec3b1c8c..6b338978c5 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -182,25 +182,16 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
 {
     BlockDriver *drv = bs->drv;
     int ret, open_ret;
-    int64_t len;
 
     if (!drv) {
         error_setg(errp, "Block driver is closed");
         return -ENOMEDIUM;
     }
 
-    len = bdrv_getlength(bs);
-    if (len < 0) {
-        error_setg_errno(errp, -len, "Cannot get block device size");
-        return len;
+    if (!QLIST_EMPTY(&bs->dirty_bitmaps)) {
+        error_setg(errp, "Device has active dirty bitmaps");
+        return -EBUSY;
     }
-    /* We should set all bits in all enabled dirty bitmaps, because dirty
-     * bitmaps reflect active state of disk and snapshot switch operation
-     * actually dirties active state.
-     * TODO: It may make sense not to set all bits but analyze block status of
-     * current state and destination snapshot and do not set bits corresponding
-     * to both-zero or both-unallocated areas. */
-    bdrv_set_dirty(bs, 0, len);
 
     if (drv->bdrv_snapshot_goto) {
         ret = drv->bdrv_snapshot_goto(bs, snapshot_id);
-- 
2.13.6

  parent reply	other threads:[~2017-11-20 14:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 14:50 [Qemu-devel] [PATCH for-2.11 0/3] block: Error out on load_vm with active dirty bitmaps Kevin Wolf
2017-11-20 14:50 ` [Qemu-devel] [PATCH for-2.11 1/3] block: Add errp to bdrv_snapshot_goto() Kevin Wolf
2017-11-20 16:07   ` Vladimir Sementsov-Ogievskiy
2017-11-20 16:23     ` Kevin Wolf
2017-11-20 16:31       ` Vladimir Sementsov-Ogievskiy
2017-11-20 14:50 ` [Qemu-devel] [PATCH for-2.11 2/3] block: Add errp to bdrv_all_goto_snapshot() Kevin Wolf
2017-11-20 16:14   ` Vladimir Sementsov-Ogievskiy
2017-11-20 14:50 ` Kevin Wolf [this message]
2017-11-20 16:16   ` [Qemu-devel] [PATCH for-2.11 3/3] block: Error out on load_vm with active dirty bitmaps Vladimir Sementsov-Ogievskiy
2017-11-20 15:14 ` [Qemu-devel] [PATCH for-2.11 0/3] " Eric Blake
2017-11-20 15:21 ` Denis V. Lunev
2017-11-21  0:37 ` John Snow

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=20171120145006.551-4-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).