From nobody Mon Feb 9 04:59:58 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 1537368638344938.00490107503; Wed, 19 Sep 2018 07:50:38 -0700 (PDT) Received: from localhost ([::1]:45759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2doL-00014v-49 for importer@patchew.org; Wed, 19 Sep 2018 10:50:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2dmG-0008Dz-RG for qemu-devel@nongnu.org; Wed, 19 Sep 2018 10:48:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2dmC-0000Kd-QI for qemu-devel@nongnu.org; Wed, 19 Sep 2018 10:48:28 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:56744) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g2dmC-0000Em-1E; Wed, 19 Sep 2018 10:48:24 -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 1g2dm9-0003dG-Bu; Wed, 19 Sep 2018 16:48:21 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1g2dlt-0004Tk-Rs; Wed, 19 Sep 2018 17:48:05 +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=8uF5LtYgKZTE6uKrmyjuYIGyCCuDw3jPavzeyZimOI0=; b=HSWoETAXOQTX7R/9sa3/FMQ0dJw7F5TJpXL73YHxOHdd1LZBey/CvMUZv5BDJF0M7PHiO5KpaBomjUX+6ld3xA9IA1dofGiGH8kRCEKIa0phVedJwmkevraqytr8syZwwL4XJ00ChYTi1JbBIOSM0/DjW3GuIBGfK7LH7KoFm+ATJVi32OGIHv+xEouEjTUQXXVuvNpSccTDhaYzAluKpGrgoGi58GLD13oI/JjY6RAdHkkUGEAWVecSNeRLMJN5BoCDaS1xwM2F0JkoLjTPPeqi7gfXbAxqrGCUwTnagCUI6oQhIGxyf3IbyLxcsULxO75w3eODsMSTlL+Mqx1idA==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Wed, 19 Sep 2018 17:47:45 +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 07/14] block: Use bdrv_reopen_set_read_only() in qmp_change_backing_file() 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" This patch replaces the bdrv_reopen() calls that set and remove the BDRV_O_RDWR flag with the new bdrv_reopen_set_read_only() function. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- blockdev.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/blockdev.c b/blockdev.c index 72f5347df5..58e057b0d9 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3996,7 +3996,6 @@ void qmp_change_backing_file(const char *device, BlockDriverState *image_bs =3D NULL; Error *local_err =3D NULL; bool ro; - int open_flags; int ret; =20 bs =3D qmp_get_root_bs(device, errp); @@ -4038,13 +4037,10 @@ void qmp_change_backing_file(const char *device, } =20 /* if not r/w, reopen to make r/w */ - open_flags =3D image_bs->open_flags; ro =3D bdrv_is_read_only(image_bs); =20 if (ro) { - bdrv_reopen(image_bs, open_flags | BDRV_O_RDWR, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (bdrv_reopen_set_read_only(image_bs, false, errp) !=3D 0) { goto out; } } @@ -4060,7 +4056,7 @@ void qmp_change_backing_file(const char *device, } =20 if (ro) { - bdrv_reopen(image_bs, open_flags, &local_err); + bdrv_reopen_set_read_only(image_bs, true, &local_err); error_propagate(errp, local_err); } =20 --=20 2.11.0