From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKgTM-0004ho-G4 for qemu-devel@nongnu.org; Fri, 22 Aug 2014 00:29:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKgTG-0003W6-AZ for qemu-devel@nongnu.org; Fri, 22 Aug 2014 00:29:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKgTG-0003Vv-0q for qemu-devel@nongnu.org; Fri, 22 Aug 2014 00:29:02 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7M4T1sU016940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 22 Aug 2014 00:29:01 -0400 Date: Fri, 22 Aug 2014 12:29:17 +0800 From: Fam Zheng Message-ID: <20140822042917.GD3410@T430.redhat.com> References: <1408622216-9578-1-git-send-email-famz@redhat.com> <1408622216-9578-7-git-send-email-famz@redhat.com> <20140821165244.GE22844@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140821165244.GE22844@stefanha-thinkpad.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: Stefan Hajnoczi Cc: Kevin Wolf , Paolo Bonzini , qemu-devel@nongnu.org On Thu, 08/21 17:52, Stefan Hajnoczi wrote: > 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); > > } > > > > +static void blkdebug_aio_cancel_async(BlockDriverAIOCB *blockacb) > > +{ > > + BlkdebugAIOCB *acb = container_of(blockacb, BlkdebugAIOCB, common); > > + blockacb->cb(blockacb->opaque, -ECANCELED); > > + qemu_aio_release(acb); > > +} > > + > > static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb) > > { > > BlkdebugAIOCB *acb = 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()? > I'll drop this patch and send a separate fix for blkdebug_aio_cancel. Fam