From nobody Mon Apr 29 07:29:23 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155023876094439.81420576835501; Fri, 15 Feb 2019 05:52:40 -0800 (PST) Received: from localhost ([127.0.0.1]:40294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guduw-000482-G7 for importer@patchew.org; Fri, 15 Feb 2019 08:52:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudsn-00037N-8Q for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:50:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gudse-0006xn-Pt for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:50:18 -0500 Received: from fanzine.igalia.com ([91.117.99.155]:56992) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gudsa-0006cU-SF; Fri, 15 Feb 2019 08:50:14 -0500 Received: from 62-165-147-230.co.dnainternet.fi ([62.165.147.230] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1gudsF-0007C4-CD; Fri, 15 Feb 2019 14:49:51 +0100 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1guds1-0003mT-Ez; Fri, 15 Feb 2019 15:49:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Message-Id:Date:Subject:Cc:To:From; bh=5LIid8sRQ4Im8nPktaMzsIYMN85iAeS7IEA4r2ttnUE=; b=IpBoOmzPsJVLh0X80PAJotxnRzEKzYS6dY+Iu2vo4tr6GzWVzM9NjoorVjV2xHYvRNAbP/Em/3jDESj9fuczBDBz3zt4Bbc9LVTT1q4LwMZSalIZ6Q7O9LoxpMRBWJN5L8OV2qA5Cp8yZU3syAm5vZcEkSo1wu5/B8iZFlCp199QqAMeT5ZeafkIBqs9JQhjXelDp1INKDCU76sM7x38ex1/MufTpwvFbIKAfztHr9gBC4JUcxozA5hcHrPQD/6YnqTj9a/dWHoqZhFL0tzZB5zRRelkLLPyGW/ArNbwlX4b+10hRvTWtxmaYeSONxNfuqinVxwIoPyUHTKw18DJJA==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 15:49:32 +0200 Message-Id: <20190215134932.14492-1-berto@igalia.com> X-Mailer: git-send-email 2.11.0 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] commit: Replace commit_top_bs on failure after deleting the block job 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) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If there's an error in commit_start() then the block job must be deleted before replacing commit_top_bs, otherwise it will fail because of lack of permissions. This happens since the permission system was introduced in 8dfba2797761d8a43744e4e6571c8175e448a478. Fortunately this bug doesn't seem to be possible to reproduce at the moment without changing the code. Signed-off-by: Alberto Garcia --- block/commit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/commit.c b/block/commit.c index 53148e610b..5deb05925b 100644 --- a/block/commit.c +++ b/block/commit.c @@ -374,10 +374,12 @@ fail: if (s->top) { blk_unref(s->top); } + 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. */ if (commit_top_bs) { bdrv_replace_node(commit_top_bs, top, &error_abort); } - job_early_fail(&s->common.job); } =20 =20 --=20 2.11.0