From nobody Sun Feb 8 12:20: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; dkim=fail; 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 1539952166564314.10328717028995; Fri, 19 Oct 2018 05:29:26 -0700 (PDT) Received: from localhost ([::1]:49975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDTu9-0007bR-Cf for importer@patchew.org; Fri, 19 Oct 2018 08:29:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDTrP-0004ra-W0 for qemu-devel@nongnu.org; Fri, 19 Oct 2018 08:26:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDTrB-00005p-4O for qemu-devel@nongnu.org; Fri, 19 Oct 2018 08:26:26 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:51809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gDTr2-00074m-2q; Fri, 19 Oct 2018 08:26:12 -0400 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1gDTq3-00081M-NO; Fri, 19 Oct 2018 14:25:11 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1gDTpj-0002Ll-W3; Fri, 19 Oct 2018 15:24:51 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=k39cint+yiHeqF9nCC+izn0gOH3D+/TYCMJQCWY8EkU=; b=iV1R4GlbnNauecsd9TW+yKLg+AOiVgnGHR0S/W9nVaTGrcei1lZsZb6GsN2zw3cW3BgTtg+DQjfBuluNuNEAg++7j1GGM8m/NFKxssr8c0qsXrDv0Aq0jneS3cuXumaiA4WJ6JyAI88qyLhzSr85H63rMFHa9wuxsA76I+GGcv6FTwz1Q3TCk5AMjQJPe8QixPNo69vvpAsIbiuzRUT6CJ5AzY0cs1saUaZ8UIOoXLhQmvgjBbC+fsIytQsNecj7wTvqkQPvSIMa2BiNthxfRnEomWK+kH0f2jWRosPiyMLPoqsdbn/32F+mNHDexCRzBMgT5SKbv9wq8rF7nedyTw==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Fri, 19 Oct 2018 15:24:46 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH v3 15/15] block: Assert that flags are up-to-date in bdrv_reopen_prepare() 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 , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Towards the end of bdrv_reopen_queue_child(), before starting to process the children, the update_flags_from_options() function is called in order to have BDRVReopenState.flags in sync with the options from the QDict. This is necessary because during the reopen process flags must be updated for all nodes in the queue so bdrv_is_writable_after_reopen() and the permission checks work correctly. Because of that, calling update_flags_from_options() again in bdrv_reopen_prepare() doesn't really change the flags (they are already up-to-date). But we need to call it in order to remove those options from QemuOpts and that way indicate that they have been processed. Signed-off-by: Alberto Garcia --- block.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block.c b/block.c index 0a0de2dc78..1d1cf3fb5f 100644 --- a/block.c +++ b/block.c @@ -3143,6 +3143,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state= , BlockReopenQueue *queue, Error **errp) { int ret =3D -1; + int old_flags; Error *local_err =3D NULL; BlockDriver *drv; QemuOpts *opts; @@ -3168,7 +3169,12 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_stat= e, BlockReopenQueue *queue, goto error; } =20 + /* This was already called in bdrv_reopen_queue_child() so the flags + * are up-to-date. This time we simply want to remove the options from + * QemuOpts in order to indicate that they have been processed. */ + old_flags =3D reopen_state->flags; update_flags_from_options(&reopen_state->flags, opts); + assert(old_flags =3D=3D reopen_state->flags); =20 discard =3D qemu_opt_get_del(opts, "discard"); if (discard !=3D NULL) { --=20 2.11.0