From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmTQy-0003to-Qh for qemu-devel@nongnu.org; Mon, 19 May 2014 15:41:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmTQu-00034c-F7 for qemu-devel@nongnu.org; Mon, 19 May 2014 15:41:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmTQu-00034W-7J for qemu-devel@nongnu.org; Mon, 19 May 2014 15:41:12 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4JJZ6U8012995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 19 May 2014 15:35:07 -0400 Message-ID: <537A5CE9.9020801@redhat.com> Date: Mon, 19 May 2014 13:35:05 -0600 From: Eric Blake MIME-Version: 1.0 References: <1399858555-9672-1-git-send-email-famz@redhat.com> <1399858555-9672-8-git-send-email-famz@redhat.com> In-Reply-To: <1399858555-9672-8-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a7ocOOhbW6aN3Tjjo18qTRbwMjADuWlka" Subject: Re: [Qemu-devel] [PATCH v19 07/16] block: Add backing_blocker in BlockDriverState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: kwolf@redhat.com, jcody@redhat.com, hbrock@redhat.com, rjones@redhat.com, armbru@redhat.com, imain@redhat.com, stefanha@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --a7ocOOhbW6aN3Tjjo18qTRbwMjADuWlka Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/11/2014 07:35 PM, Fam Zheng wrote: > This makes use of op_blocker and blocks all the operations except for > commit target, on each BlockDriverState->backing_hd. >=20 > The asserts for op_blocker in bdrv_swap are removed because with this > change, the target of block commit has at least the backing blocker of > its child, so the assertion is not true. Callers should do their check.= >=20 > Signed-off-by: Fam Zheng > --- > block.c | 24 ++++++++++++++++++++---- > block/mirror.c | 1 + > include/block/block_int.h | 3 +++ > 3 files changed, 24 insertions(+), 4 deletions(-) >=20 > diff --git a/block.c b/block.c > index ec26a2b..8155e68 100644 > --- a/block.c > +++ b/block.c > @@ -1097,14 +1097,31 @@ fail: > void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backi= ng_hd) > { > =20 > + if (bs->backing_hd) { > + assert(error_is_set(&bs->backing_blocker)); error_is_set() is going away. Please don't use it. https://lists.gnu.org/archive/html/qemu-devel/2014-05/msg03801.html This can just be assert(bs->backing_blocker). > + bdrv_op_unblock_all(bs->backing_hd, bs->backing_blocker); > + } else if (backing_hd) { > + error_setg(&bs->backing_blocker, > + "device is used as backing hd of '%s'", > + bs->device_name); > + } > + > bs->backing_hd =3D backing_hd; > if (!backing_hd) { > + if (error_is_set(&bs->backing_blocker)) { > + error_free(bs->backing_blocker); if (bs->backing_blocker) { --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --a7ocOOhbW6aN3Tjjo18qTRbwMjADuWlka Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTelzpAAoJEKeha0olJ0Nqi8IH/RQUkl1SKFXza6+INkA55zSW XdsE1qVi/BrNojLfbR+dgmNVniy5ynG1co7nHb0Ja1Un5IvrCIzk/dx3Zd0DGRcZ yP8xE66PNUGoGXUf9TN2gVz02tX+tanrAr/DTLioKKpkQThs9h47yLZua1Ee8U6R RHTZn30f5oPSd+Fq1pfxE708rPZ+Ck7mWHNpGVgiKykn630a+Ozc8Va/aMlrYl2i RzJ5xXl6Il7k2ACSofO5eEondtOB1RMUQiQEfOPwjaS3ZvvrIZBklMaaaNZlHGQK XVb0DgISWGo53+nYu6mlIex/gqldHlvA4QLssL2+PMyOawKhdD0I7rmLdgMvEqY= =zWfZ -----END PGP SIGNATURE----- --a7ocOOhbW6aN3Tjjo18qTRbwMjADuWlka--