From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKRkl-0005Dm-CK for qemu-devel@nongnu.org; Wed, 29 Jul 2015 09:50:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKRkh-0004BZ-Rb for qemu-devel@nongnu.org; Wed, 29 Jul 2015 09:50:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47283) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKRkh-0004Ai-NI for qemu-devel@nongnu.org; Wed, 29 Jul 2015 09:50:35 -0400 From: Stefan Hajnoczi Date: Wed, 29 Jul 2015 14:50:29 +0100 Message-Id: <1438177831-28195-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1438177831-28195-1-git-send-email-stefanha@redhat.com> References: <1438177831-28195-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL for-2.4 1/3] virtio-blk-dataplane: delete bottom half before the AioContext is freed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi , Paolo Bonzini From: Paolo Bonzini Other uses of aio_bh_new are safe as long as all scheduled bottom halves are run before an iothread is destroyed, which bdrv_drain will ensure: - archipelago_finish_aiocb: BH deletes itself - inject_error: BH deletes itself - blkverify_aio_bh: BH deletes itself - abort_aio_request: BH deletes itself - curl_aio_readv: BH deletes itself - gluster_finish_aiocb: BH deletes itself - bdrv_aio_rw_vector: BH deletes itself - bdrv_co_maybe_schedule_bh: BH deletes itself - iscsi_schedule_bh, iscsi_co_generic_cb: BH deletes itself - laio_attach_aio_context: deleted in laio_detach_aio_context, called through bdrv_detach_aio_context before deleting the iothread - nfs_co_generic_cb: BH deletes itself - null_aio_common: BH deletes itself - qed_aio_complete: BH deletes itself - rbd_finish_aiocb: BH deletes itself - dma_blk_cb: BH deletes itself - virtio_blk_dma_restart_cb: BH deletes itself - qemu_bh_new: main loop AioContext is never destroyed - test-aio.c: bh_delete_cb deletes itself, otherwise deleted in the same function that calls aio_bh_new Reported-by: Cornelia Huck Signed-off-by: Paolo Bonzini Message-id: 1438101249-25166-2-git-send-email-pbonzini@redhat.com Message-Id: <1438086628-13000-1-git-send-email-pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 3db139b..6106e46 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -223,8 +223,8 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s) virtio_blk_data_plane_stop(s); blk_op_unblock_all(s->conf->conf.blk, s->blocker); error_free(s->blocker); - object_unref(OBJECT(s->iothread)); qemu_bh_delete(s->bh); + object_unref(OBJECT(s->iothread)); g_free(s); } -- 2.4.3