From nobody Tue Feb 10 17:08:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511277327179183.71085761189727; Tue, 21 Nov 2017 07:15:27 -0800 (PST) Received: from localhost ([::1]:35021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHAGg-0007ty-CF for importer@patchew.org; Tue, 21 Nov 2017 10:15:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHACC-0003Ev-05 for qemu-devel@nongnu.org; Tue, 21 Nov 2017 10:10:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHAC7-0005HQ-7q for qemu-devel@nongnu.org; Tue, 21 Nov 2017 10:10:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51230) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eHAC1-0005CA-PU; Tue, 21 Nov 2017 10:10:33 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04CD7356C4; Tue, 21 Nov 2017 15:10:33 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-148.ams2.redhat.com [10.36.117.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 080DC7FAA3; Tue, 21 Nov 2017 15:10:30 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 21 Nov 2017 16:10:15 +0100 Message-Id: <20171121151017.28158-6-kwolf@redhat.com> In-Reply-To: <20171121151017.28158-1-kwolf@redhat.com> References: <20171121151017.28158-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 Nov 2017 15:10:33 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/7] block: Error out on load_vm with active dirty bitmaps X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow --- block/snapshot.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/block/snapshot.c b/block/snapshot.c index 8585599579..8cb70dbad5 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -182,25 +182,16 @@ int bdrv_snapshot_goto(BlockDriverState *bs, { BlockDriver *drv =3D bs->drv; int ret, open_ret; - int64_t len; =20 if (!drv) { error_setg(errp, "Block driver is closed"); return -ENOMEDIUM; } =20 - len =3D 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 statu= s of - * current state and destination snapshot and do not set bits correspo= nding - * to both-zero or both-unallocated areas. */ - bdrv_set_dirty(bs, 0, len); =20 if (drv->bdrv_snapshot_goto) { ret =3D drv->bdrv_snapshot_goto(bs, snapshot_id); --=20 2.13.6