Received: from eggs.gnu.org ([2001:4830:134:3::10]:44237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKVbZ-0005rm-T2 for qemu-devel@nongnu.org; Thu, 21 Aug 2014 12:52:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKVbT-0001T0-Nb for qemu-devel@nongnu.org; Thu, 21 Aug 2014 12:52:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKVbT-0001Sm-EG for qemu-devel@nongnu.org; Thu, 21 Aug 2014 12:52:47 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7LGqka9032666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 21 Aug 2014 12:52:46 -0400 Date: Thu, 21 Aug 2014 17:52:45 +0100 From: Stefan Hajnoczi Message-ID: <20140821165244.GE22844@stefanha-thinkpad.redhat.com> References: <1408622216-9578-1-git-send-email-famz@redhat.com> <1408622216-9578-7-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u5E4XgoOPWr4PD9E" Content-Disposition: inline In-Reply-To: <1408622216-9578-7-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 6/9] blkdebug: Implement .cancel_async List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org --u5E4XgoOPWr4PD9E Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 21, 2014 at 07:56:53PM +0800, Fam Zheng wrote: > @@ -446,12 +439,25 @@ static void error_callback_bh(void *opaque) > qemu_aio_release(acb); > } > =20 > +static void blkdebug_aio_cancel_async(BlockDriverAIOCB *blockacb) > +{ > + BlkdebugAIOCB *acb =3D container_of(blockacb, BlkdebugAIOCB, common); > + blockacb->cb(blockacb->opaque, -ECANCELED); > + qemu_aio_release(acb); > +} > + > static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb) > { > BlkdebugAIOCB *acb =3D container_of(blockacb, BlkdebugAIOCB, common); > qemu_aio_release(acb); > } Both blkdebug_aio_cancel() and blkdebug_aio_cancel_async() look incorrect. It is not safe to release acb because the error_callback_bh() BH may still be scheduled. I guess we don't hit this problem because the error injection happens within the same event loop iteration. In practice no one ever calls blkdebug_aio_cancel()? Stefan --u5E4XgoOPWr4PD9E Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT9iPcAAoJEJykq7OBq3PIUGQH/17yp6nUYOIFMqzXD4AU4pSj tF/BvlcqPdgDbw3d15oaW/q9l4dzs8Es1u0Y3yWjDA6bND2keR1TxaQI+X+FyQGM j7AnIDob078e0JNbAtCaHuYKFoqsfj8ibFnu/uuCk8qJiFIBIYv/7l7v1v+u4CYI 5/9Lh369nePouYskI17okGHmo4YdeyD64EslaeU9rDOytzati7R2u9WKKJzAz6fV T0L1xGH/tSEjfT4+iSgwp3KJwCHTIID7LTq0Ot6Jrd2vdFKaSLS+J60kNbJ++Bgp kGSPal+4a/Bzs5vdKdWGuYmqufFmRFZ6fssGnx/EZbBozbJav+NpEXV+bmi4bHc= =TJS2 -----END PGP SIGNATURE----- --u5E4XgoOPWr4PD9E--