From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaTDi-0005DE-94 for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:38:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaTDe-0007rA-0O for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:38:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaTDd-0007qQ-PX for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:38:41 -0400 References: <1441611277-24596-1-git-send-email-famz@redhat.com> <1441611277-24596-11-git-send-email-famz@redhat.com> From: Max Reitz Message-ID: <55F31FAB.8000002@redhat.com> Date: Fri, 11 Sep 2015 20:38:35 +0200 MIME-Version: 1.0 In-Reply-To: <1441611277-24596-11-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FttKui9dRN1Rnx00e2XQxqsVmitkQQVag" Subject: Re: [Qemu-devel] [PATCH v5 10/14] blockdev: make BlockJobTxn available to qmp 'transaction' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , vsementsov@parallels.com, stefanha@redhat.com, John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FttKui9dRN1Rnx00e2XQxqsVmitkQQVag Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 07.09.2015 09:34, Fam Zheng wrote: > From: Stefan Hajnoczi >=20 > Provide a BlockJobTxn to actions executed in a qmp 'transaction' > command. This allows actions to make their block jobs either complete > as a group or fail/cancel together. >=20 > The next patch adds the first user. >=20 > Signed-off-by: Stefan Hajnoczi > Reviewed-by: Fam Zheng > Reviewed-by: John Snow You can vouch for yourself, but can you vouch for John being fine with the change from v4? ;-) > Signed-off-by: Fam Zheng > --- > blockdev.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/blockdev.c b/blockdev.c > index 4ebded8..3d5e5cd 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -1285,6 +1285,7 @@ typedef struct BlkActionOps { > struct BlkActionState { > TransactionAction *action; > const BlkActionOps *ops; > + BlockJobTxn *block_job_txn; > QSIMPLEQ_ENTRY(BlkActionState) entry; > }; > =20 > @@ -1889,12 +1890,15 @@ static const BlkActionOps actions[] =3D { > void qmp_transaction(TransactionActionList *dev_list, Error **errp) > { > TransactionActionList *dev_entry =3D dev_list; > + BlockJobTxn *block_job_txn; > BlkActionState *state, *next; > Error *local_err =3D NULL; > =20 > QSIMPLEQ_HEAD(snap_bdrv_states, BlkActionState) snap_bdrv_states; > QSIMPLEQ_INIT(&snap_bdrv_states); > =20 > + block_job_txn =3D block_job_txn_new(); > + > /* drain all i/o before any operations */ > bdrv_drain_all(); > =20 > @@ -1914,6 +1918,7 @@ void qmp_transaction(TransactionActionList *dev_l= ist, Error **errp) > state =3D g_malloc0(ops->instance_size); > state->ops =3D ops; > state->action =3D dev_info; > + state->block_job_txn =3D block_job_txn; > QSIMPLEQ_INSERT_TAIL(&snap_bdrv_states, state, entry); > =20 > state->ops->prepare(state, &local_err); > @@ -1940,6 +1945,7 @@ delete_and_fail: > } > } > exit: > + block_job_txn_unref(block_job_txn); > QSIMPLEQ_FOREACH_SAFE(state, &snap_bdrv_states, entry, next) { > if (state->ops->clean) { > state->ops->clean(state); >=20 I'd put the unref() call after the FOREACH loop, since the txn is referenced by every state->block_job_txn, so the state->ops->clean() operation may still try to access that field. Max --FttKui9dRN1Rnx00e2XQxqsVmitkQQVag 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 iQEcBAEBCAAGBQJV8x+rAAoJEDuxQgLoOKytlasIAIU21k2Jt/+JDUYPU+uONexF LMaOTRjjlldW5cyM9/iZ0jGY8SBeucQDb4kTPzd6Gf+qUhxfAh8U5IWlolFDtD42 C77r3LgMQgPECuY6oeZ376YcdaXBq5mJ7RPF7STjA2GzXD6G/LatlVEzdERj+r0f YW6r7ewpTg3ZB+IkpgqM7UhwmzM1PSLnJ5anJnbURNPFBBqL9Y/r+xFaZfbHlwWp AoBGfskzP66NbrYMXyhykQ+EOzTzntF5YUndoCGnh/L2p+mGtVKShy7LNSMOUFW5 qBTZorBfj0/kIC4FaDha5DvDtFrvyhO5P9Bf6ePXZ1h+kAvp5yTWZyMqfebRghw= =LXg5 -----END PGP SIGNATURE----- --FttKui9dRN1Rnx00e2XQxqsVmitkQQVag--