From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:41079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtZeS-00030j-5o for qemu-devel@nongnu.org; Tue, 12 Feb 2019 10:07:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtZS6-0003gY-14 for qemu-devel@nongnu.org; Tue, 12 Feb 2019 09:54:26 -0500 Date: Tue, 12 Feb 2019 15:54:15 +0100 From: Kevin Wolf Message-ID: <20190212145415.GD5283@localhost.localdomain> References: <2da7b388a740d1f1b7f40e1182fc821f8abb8fbb.1547739122.git.berto@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2da7b388a740d1f1b7f40e1182fc821f8abb8fbb.1547739122.git.berto@igalia.com> Subject: Re: [Qemu-devel] [PATCH 02/13] block: Freeze the backing chain for the duration of the commit job List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz Am 17.01.2019 um 16:33 hat Alberto Garcia geschrieben: > 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 = container_of(job, CommitBlockJob, common.job); > > + 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 = container_of(job, CommitBlockJob, common.job); > BlockDriverState *top_bs = blk_bs(s->top); > > + bdrv_unfreeze_backing_chain(s->commit_top_bs, s->base_bs); commit_abort() will run if commit_prepare() returned an error, so we may end up unfreezing twice. Maybe move it into the 'if (s->base)' block a few lines down. > /* 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, > } > } > > + if (bdrv_freeze_backing_chain(commit_top_bs, base, errp) < 0) { > + goto fail; > + } Don't error paths need to unfreeze after this? Kevin