From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dId1O-0003gb-7H for qemu-devel@nongnu.org; Wed, 07 Jun 2017 11:37:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dId1N-0005ZH-AN for qemu-devel@nongnu.org; Wed, 07 Jun 2017 11:37:22 -0400 References: From: Eric Blake Message-ID: Date: Wed, 7 Jun 2017 10:37:13 -0500 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Xehldbbq6FGxfCJdLKR55A4NlVn8tEDuD" Subject: Re: [Qemu-devel] [PATCH] block: fix external snapshot abort permission error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Xehldbbq6FGxfCJdLKR55A4NlVn8tEDuD From: Eric Blake To: Jeff Cody , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org Message-ID: Subject: Re: [Qemu-devel] [PATCH] block: fix external snapshot abort permission error References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/07/2017 08:55 AM, Jeff Cody wrote: > In external_snapshot_abort(), we try to undo what was done in > external_snapshot_prepare() calling bdrv_replace_node() to swap the > nodes back. However, we receive a permissions error as writers are > blocked on the old node, which is now the new node backing file. >=20 > An easy fix (initially suggested by Kevin Wolf) is to call > bdrv_set_backing_hd() on the new node, to set the backing node to NULL.= >=20 > Signed-off-by: Jeff Cody > --- > blockdev.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 Reviewed-by: Eric Blake > diff --git a/blockdev.c b/blockdev.c > index 892d768..6472548 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -1803,7 +1803,11 @@ static void external_snapshot_abort(BlkActionSta= te *common) > DO_UPCAST(ExternalSnapshotState, common, = common); > if (state->new_bs) { > if (state->overlay_appended) { > + bdrv_ref(state->old_bs); /* we can't let bdrv_set_backin= d_hd() > + close state->old_bs; we need= it */ > + bdrv_set_backing_hd(state->new_bs, NULL, &error_abort); > bdrv_replace_node(state->new_bs, state->old_bs, &error_abo= rt); > + bdrv_unref(state->old_bs); /* bdrv_replace_node() ref'ed o= ld_bs */ > } > } > } >=20 --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --Xehldbbq6FGxfCJdLKR55A4NlVn8tEDuD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJZOB2pAAoJEKeha0olJ0Nq+I4H/3fmgs4QPzDKSmL+sDMAWonR 0GUdFPwtvyybYQ68/PyT847SowgXRzuBh1aKIxw5IkkQ/qnPdxkorQMvTLFRC3qx OH6d0mS9WE2CS8iUtDBW5CDuG5g4wiKykGU1dKB9fyqPy9D2ZLGQJ6TECr12TnGc i6vO6DE9zVZQuyNMU70ULL1I1TVExV+Z5AJ4wLsWc+7ofotAivFdsKR9d3zZbPQK Pm2yIqr1hPcc4iphhiQ/4vBNQGjE9/jeTlql9pm+uFJQxE+MA47WkJ/W9KRQppPe RULlxqa3JX3XyY/mah6pY1F3QwFJ8TPMOHV19hRDqOx3N39QEASIOgfVsWvkAAU= =BBIz -----END PGP SIGNATURE----- --Xehldbbq6FGxfCJdLKR55A4NlVn8tEDuD--