From nobody Fri Nov 7 12:01:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) 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=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) 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 1547740090732151.09575392619524; Thu, 17 Jan 2019 07:48:10 -0800 (PST) Received: from localhost ([127.0.0.1]:46895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk9tp-0004d0-NZ for importer@patchew.org; Thu, 17 Jan 2019 10:48:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk9gp-0001ty-Bz for qemu-devel@nongnu.org; Thu, 17 Jan 2019 10:34:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gk9go-0007qJ-0R for qemu-devel@nongnu.org; Thu, 17 Jan 2019 10:34:43 -0500 Received: from fanzine.igalia.com ([91.117.99.155]:59803) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gk9gn-0007IW-IJ; Thu, 17 Jan 2019 10:34:41 -0500 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 1gk9gY-0003bV-EH; Thu, 17 Jan 2019 16:34:26 +0100 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1gk9gI-0007R7-R1; Thu, 17 Jan 2019 17:34:10 +0200 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=+/4khAbQMeVy1KVoG0qdWT2tHAMnDkEkpa2xD6AjZPA=; b=OYy3gR8Hi+WBUXLpeb3AKu3yx/LSeSdqLwwzcddWkHATtF501HOAARYJGhBhCrFwR6KT2SFjUL0FTyOPLQ4Ktxv12Wu0dqVQy+WJVISC6mrBJNclLFpnu+RwyprEY8OMxeXMJumcXNflzqX+HQR/CTM/K6Rzr/SaOmXB8djz4s6nhvsY9kol6AIFSEdRjs1I+W5OSYVEn3x4mFoAHoQyX4O7cydwsM6zAgfbB9njt0o/kKjtmVyc2Q6l7n0zlDk5pXiVBqo+MS6LmAKF8WD3MH34yP/OeFLrIQIb9PY1WwnkQd7HqzGMj+GvcFdsQ20yHrtqj1G9xNk9Ws2mDjAp2w==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 17 Jan 2019 17:33:53 +0200 Message-Id: <2da7b388a740d1f1b7f40e1182fc821f8abb8fbb.1547739122.git.berto@igalia.com> 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 02/13] block: Freeze the backing chain for the duration of the commit 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" Signed-off-by: Alberto Garcia --- block/commit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/commit.c b/block/commit.c index 53148e610b..8824d135e0 100644 --- a/block/commit.c +++ b/block/commit.c @@ -73,6 +73,8 @@ static int commit_prepare(Job *job) { CommitBlockJob *s =3D container_of(job, CommitBlockJob, common.job); =20 + bdrv_unfreeze_backing_chain(s->commit_top_bs, s->base_bs); + /* Remove base node parent that still uses BLK_PERM_WRITE/RESIZE before * the normal backing chain can be restored. */ blk_unref(s->base); @@ -89,6 +91,8 @@ static void commit_abort(Job *job) CommitBlockJob *s =3D container_of(job, CommitBlockJob, common.job); BlockDriverState *top_bs =3D blk_bs(s->top); =20 + bdrv_unfreeze_backing_chain(s->commit_top_bs, s->base_bs); + /* Make sure commit_top_bs and top stay around until bdrv_replace_node= () */ bdrv_ref(top_bs); bdrv_ref(s->commit_top_bs); @@ -336,6 +340,10 @@ void commit_start(const char *job_id, BlockDriverState= *bs, } } =20 + if (bdrv_freeze_backing_chain(commit_top_bs, base, errp) < 0) { + goto fail; + } + ret =3D block_job_add_bdrv(&s->common, "base", base, 0, BLK_PERM_ALL, = errp); if (ret < 0) { goto fail; --=20 2.11.0