From nobody Mon Feb 9 13:38:39 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.zoho.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 1491406137360799.7727184144427; Wed, 5 Apr 2017 08:28:57 -0700 (PDT) Received: from localhost ([::1]:41036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvmrf-0003AS-VL for importer@patchew.org; Wed, 05 Apr 2017 11:28:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvmhb-00032s-6v for qemu-devel@nongnu.org; Wed, 05 Apr 2017 11:18:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvmhY-0001gE-30 for qemu-devel@nongnu.org; Wed, 05 Apr 2017 11:18:31 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:38114 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cvmhX-0001eW-OB for qemu-devel@nongnu.org; Wed, 05 Apr 2017 11:18:28 -0400 Received: from iris.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v35FIPC3032087; Wed, 5 Apr 2017 18:18:25 +0300 (MSK) From: "Denis V. Lunev" To: qemu-devel@nongnu.org Date: Wed, 5 Apr 2017 18:18:25 +0300 Message-Id: <1491405505-31620-3-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491405505-31620-1-git-send-email-den@openvz.org> References: <1491405505-31620-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH 2/2] block: assert no image modification under BDRV_O_INACTIVE 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: Kevin Wolf , "Denis V. Lunev" , Max Reitz 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" As long as BDRV_O_INACTIVE is set, the image file is only opened so we have a file descriptor for it. We're definitely not supposed to modify the image, it's still owned by the migration source. This commit is an addition to 09e0c771 but the assert() is added to bdrv_truncate(). Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Max Reitz Reviewed-by: Eric Blake --- block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block.c b/block.c index 927ba89..9273741 100644 --- a/block.c +++ b/block.c @@ -3279,6 +3279,8 @@ int bdrv_truncate(BdrvChild *child, int64_t offset) if (bs->read_only) return -EACCES; =20 + assert(!(bs->open_flags & BDRV_O_INACTIVE)); + ret =3D drv->bdrv_truncate(bs, offset); if (ret =3D=3D 0) { ret =3D refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS); --=20 2.7.4