From nobody Tue Nov 4 15:13:13 2025 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 1530272886641314.4084867518295; Fri, 29 Jun 2018 04:48:06 -0700 (PDT) Received: from localhost ([::1]:41393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYrsj-0001Bt-SY for importer@patchew.org; Fri, 29 Jun 2018 07:48:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYrjB-0001rV-L1 for qemu-devel@nongnu.org; Fri, 29 Jun 2018 07:38:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYriz-0005H9-HU for qemu-devel@nongnu.org; Fri, 29 Jun 2018 07:38:13 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:41375) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYriz-0004Td-3L; Fri, 29 Jun 2018 07:38:01 -0400 Received: from 88-114-101-78.elisa-laajakaista.fi ([88.114.101.78] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1fYriP-0006Oy-BR; Fri, 29 Jun 2018 13:37:25 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1fYriA-0008Ke-Pi; Fri, 29 Jun 2018 14:37:10 +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=VA/ds4n4neF9fJEbqQKvQN5fNNIWKTWttKWrPXVHeoo=; b=IGm71QPa8ALvF01ZcPUqhk3cEVuY6WPaI4SRScHES1Zk7ppEBkV1cFZRZlFZuQw8bVSgNq+MMwd/YHLGfkyC/9bzkSm86wUYnQWmWEnHpl4iQnqYt9OC+EqiqcOUPLhbYG2rTe3iajlyQmh5W31m/WnR+4n8vur0ITijbNZc69qXxuiXl+L5E893vth+93uNzXqpSbGgdIzr4x7CFrvo/MQUIdDjyDsFmGBrpP/smFBuJJK7jTnGEdMmYDes8+M3pJgJ6cVEPQrZhIoMTAvaU+aAwdKj3YwEoayuAOIi6S0FwIUTwy45sMuObJdt7HVOdjHO1wWcI+A66/imKaPa+g==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Fri, 29 Jun 2018 14:37:01 +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 3/5] block: Simplify bdrv_reopen_abort() 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" If a bdrv_reopen_multiple() call fails, then the explicit_options QDict has to be deleted for every entry in the reopen queue. This must happen regardless of whether that entry's bdrv_reopen_prepare() call succeeded or not. This patch simplifies the cleanup code a bit. Signed-off-by: Alberto Garcia --- block.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/block.c b/block.c index 5aaed424b9..48e8f4814c 100644 --- a/block.c +++ b/block.c @@ -3060,9 +3060,10 @@ int bdrv_reopen_multiple(AioContext *ctx, BlockReope= nQueue *bs_queue, Error **er =20 cleanup: QSIMPLEQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { - if (ret && bs_entry->prepared) { - bdrv_reopen_abort(&bs_entry->state); - } else if (ret) { + if (ret) { + if (bs_entry->prepared) { + bdrv_reopen_abort(&bs_entry->state); + } qobject_unref(bs_entry->state.explicit_options); } qobject_unref(bs_entry->state.options); @@ -3351,8 +3352,6 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state) drv->bdrv_reopen_abort(reopen_state); } =20 - qobject_unref(reopen_state->explicit_options); - bdrv_abort_perm_update(reopen_state->bs); } =20 --=20 2.11.0