From patchwork Mon Apr 29 13:51:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 1092633 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="Agt7EO9D"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44t5h23wrTz9sCJ for ; Mon, 29 Apr 2019 23:52:34 +1000 (AEST) Received: from localhost ([127.0.0.1]:57919 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL6hs-00050j-7Q for incoming@patchwork.ozlabs.org; Mon, 29 Apr 2019 09:52:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL6h9-0004zg-Ru for qemu-devel@nongnu.org; Mon, 29 Apr 2019 09:51:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hL6h8-0007tG-Ti for qemu-devel@nongnu.org; Mon, 29 Apr 2019 09:51:47 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:44144) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hL6h8-0007jJ-BZ; Mon, 29 Apr 2019 09:51:46 -0400 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=AepjI2xjb2h5M70msNzUPlt06VQQrCDG70bRmRZ80vY=; b=Agt7EO9DGCzRAswm3BxubTEU6iH5Rqt8/RRKGAG8CS+oCYpYyDxGvtOVBHGMYptZ+3v8MCRiOQP79V4ag2tjfuyzm2WO0FMP7RzldxJgRI52x4qLMPAJXKF2K0tEqjPEPUzSXL37aeqI9oBRjIItn1wsKUv4WPa2XfvtJEh6mP2t1xIaQYP+W5/sA1y5dh0mi2+bSCcBO6SlPF5ASnSx7V6YnfjSw9nOUqAzVdI6zBmgNOfzEUO6SI8bVXKww0rNdleb9rjYxmKf5X/XHNzRd8/kswtrmOLG4+IUMrA+Yqcpvb2E5XrgcZvZGU9ymV7x6wV45vMnSC4nFElVPa/OgQ==; Received: from [212.145.226.66] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hL6gq-0006BY-T9; Mon, 29 Apr 2019 15:51:28 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hL6gd-0007Kj-BT; Mon, 29 Apr 2019 16:51:15 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 15:51:08 +0200 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 1/2] commit: Make base read-only if there is an early failure 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" You can reproduce this by passing an invalid filter-node-name (like "1234") to block-commit. In this case the base image is put in read-write mode but is never reset back to read-only. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block/commit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/commit.c b/block/commit.c index ba60fef58a..698eda1dfe 100644 --- a/block/commit.c +++ b/block/commit.c @@ -384,6 +384,9 @@ fail: if (s->top) { blk_unref(s->top); } + if (s->base_read_only) { + bdrv_reopen_set_read_only(base, true, NULL); + } job_early_fail(&s->common.job); /* commit_top_bs has to be replaced after deleting the block job, * otherwise this would fail because of lack of permissions. */