From nobody Mon Feb 9 01:20:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1569592756; cv=none; d=zoho.com; s=zohoarc; b=E0Xjf4+66M53yJUF7yQ9sLSZEQzW4H91yqGQXqmVdJmKKMLztLQxhKUO5MBN9+TcnrJyYOvcJLUNUJxLXPDPOSlM9Orabe3m8/CMUSYMJptaF0SK0qXZF48r7XcU3+DMj51gRF8l0Gge/lIIL2ffzcNh4D5cRdXIra6ySuje2ZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569592756; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=V0Z+XB8LNKgRD9IUmzh0hkpu14w4aOz9D9wBiV5j87M=; b=A+SrrCwUfCf6ryuASM1AJAmp1WV0RdQl4OmoGCM7xSm80MfMPTk0QI/963R7tmm2UoLj3963UAr785vhh3LtFSBAVxAL6AqoQyTOt34Ztve/aAm2xvEmsBureMIzP7Iyeng12rtP7s7TgpYHwG3QHBPebBuQd97mTUBlrqL35U8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569592756269844.8236616566754; Fri, 27 Sep 2019 06:59:16 -0700 (PDT) Received: from localhost ([::1]:51136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDqmA-00052P-Al for importer@patchew.org; Fri, 27 Sep 2019 09:59:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34675) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDqD4-0003ur-CT for qemu-devel@nongnu.org; Fri, 27 Sep 2019 09:22:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDqD2-0000Ri-0R for qemu-devel@nongnu.org; Fri, 27 Sep 2019 09:22:57 -0400 Received: from relay.sw.ru ([185.231.240.75]:49752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iDqCw-0000IU-Pd; Fri, 27 Sep 2019 09:22:50 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iDpHx-0003za-Nm; Fri, 27 Sep 2019 15:23:57 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v5 2/9] block: reverse order for reopen commits Date: Fri, 27 Sep 2019 15:23:48 +0300 Message-Id: <20190927122355.7344-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190927122355.7344-1-vsementsov@virtuozzo.com> References: <20190927122355.7344-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" It's needed to fix reopening qcow2 with bitmaps to RW. Currently it can't work, as qcow2 needs write access to file child, to mark bitmaps in-image with IN_USE flag. But usually children goes after parents in reopen queue and file child is still RO on qcow2 reopen commit. Reverse reopen order to fix it. Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Max Reitz Acked-by: John Snow --- block.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 6a3b33f1ec..a2de16c8c7 100644 --- a/block.c +++ b/block.c @@ -3486,10 +3486,16 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue= , Error **errp) bs_entry->perms_checked =3D true; } =20 - /* If we reach this point, we have success and just need to apply the - * changes + /* + * If we reach this point, we have success and just need to apply the + * changes. + * + * Reverse order is used to comfort qcow2 driver: on commit it need to= write + * IN_USE flag to the image, to mark bitmaps in the image as invalid. = But + * children are usually goes after parents in reopen-queue, so go from= last + * to first element. */ - QTAILQ_FOREACH(bs_entry, bs_queue, entry) { + QTAILQ_FOREACH_REVERSE(bs_entry, bs_queue, entry) { bdrv_reopen_commit(&bs_entry->state); } =20 --=20 2.21.0