From nobody Mon Feb 9 23:01:01 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 1529373422350458.935487359872; Mon, 18 Jun 2018 18:57:02 -0700 (PDT) Received: from localhost ([::1]:38424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5tB-0001LC-PH for importer@patchew.org; Mon, 18 Jun 2018 21:56:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5gb-0008UR-Oj for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:43:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5ga-0007dh-RN for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:43:57 -0400 Received: from mail-ot0-x235.google.com ([2607:f8b0:4003:c0f::235]:40171) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5ga-0007dL-Mt; Mon, 18 Jun 2018 21:43:56 -0400 Received: by mail-ot0-x235.google.com with SMTP id w9-v6so20742821otj.7; Mon, 18 Jun 2018 18:43:56 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id l7-v6sm6622369oii.29.2018.06.18.18.43.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=MQCDZvnxH2X7QhZ3vwsImXz3B2EtO2dWJAp7K5qkKmA=; b=XcbdfpfyOToX+pFYvI7rbAgtKXWkEUJW2odsfeR2sX13cPlgen8z9O2GpdKiFg/MVD mAwhJghusNqscM/O46upABDwbBcx3ViTCfvO5gosL0j1AcI9xyfrc9vBFH1HmGQv86hR uSWH6Q6nDjXQhnB0UObooaZilSfqlBbCSJHAOkCSgSXbqYIHSqpQqJOi6udwQY2nJr5h s7YGS67SKbNUbw3bGjRxoQgQrknrOEaLG/YYW1XDKm9+ZUkvDyi7bBXtpB6ys0nIfvLU c5rWqFf4gPU79WguoXOcwTWXa3ka4RUFBH5C1BykdN51EK51oFFVoWDE8/A7MbuJAhXx MRlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=MQCDZvnxH2X7QhZ3vwsImXz3B2EtO2dWJAp7K5qkKmA=; b=TDK+QgVLedg41W5oy37rRtYBgTVVQ+b4MAcqg2NXmf2dGj2RdMf1JtPRe/DsBYemuk TCfZG1+SDNFMqRoAvtjI1mddWNHNYj/cpjWYZOm1rSRNn8tJGgJCwIPVZr8LG7CId9tG mGF6HW1BGmHIYi0+X4Fh7gSMGkkHphI6F+TSjlzL/o8WmL9A5r64PRE60y5e9XIw9Yzd g5aFR41Yt1+WttYgZS1ApxCjC9eK/CvUMzfY8QwcvAyJnfXTzoYI1FGZTmFujfXL363t zKyouRsuwEltJvvjJkyhKdTQW3Taax0D0XOjh58+GaDxJdoswMAYnTP8BbtlVtNi2e56 STbA== X-Gm-Message-State: APt69E146CaMUpBpd9WLoR/5WYkLUq0V+9d91eD1zBAltc9sz1mfrXdL 69AhzFhMp2ar28UeFb+BX/+y4SPv X-Google-Smtp-Source: ADUXVKL5kvEv3V3Ksk1GNvs91fU0tAyzXFNsNzocwGs1hPRDZN/3wx04eygfwAN2/AopsDlBEZoG2Q== X-Received: by 2002:a9d:754a:: with SMTP id b10-v6mr8695389otl.73.1529372635521; Mon, 18 Jun 2018 18:43:55 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:43:08 -0500 Message-Id: <20180619014319.28272-103-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::235 Subject: [Qemu-devel] [PATCH 102/113] qcow2: Do not mark inactive images corrupt 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: qemu-stable@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" From: Max Reitz When signaling a corruption on a read-only image, qcow2 already makes fatal events non-fatal (i.e., they will not result in the image being closed, and the image header's corrupt flag will not be set). This is necessary because we cannot set the corrupt flag on read-only images, and it is possible because further corruption of read-only images is impossible. Inactive images are effectively read-only, too, so we should do the same for them. bdrv_is_writable() can tell us whether an image can actually be written to, so use its result instead of !bs->read_only. (Otherwise, the assert(!(bs->open_flags & BDRV_O_INACTIVE)) in bdrv_co_pwritev() will fail, crashing qemu.) Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Message-id: 20180606193702.7113-3-mreitz@redhat.com Reviewed-by: John Snow Reviewed-by: Jeff Cody Signed-off-by: Max Reitz (cherry picked from commit ddf3b47ef4b5ed0bf6558d4c2c8ae130b8d8a580) Signed-off-by: Michael Roth --- block/qcow2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/qcow2.c b/block/qcow2.c index 1914a940e5..28f2d91797 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4235,7 +4235,7 @@ void qcow2_signal_corruption(BlockDriverState *bs, bo= ol fatal, int64_t offset, char *message; va_list ap; =20 - fatal =3D fatal && !bs->read_only; + fatal =3D fatal && bdrv_is_writable(bs); =20 if (s->signaled_corruption && (!fatal || (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT))) --=20 2.11.0