From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgXYI-000143-SJ for qemu-devel@nongnu.org; Tue, 21 Oct 2014 07:24:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgXY8-0001Oi-Li for qemu-devel@nongnu.org; Tue, 21 Oct 2014 07:24:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgXY8-0001Oa-EG for qemu-devel@nongnu.org; Tue, 21 Oct 2014 07:24:24 -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 s9LBONaA021679 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 21 Oct 2014 07:24:24 -0400 Message-ID: <54464265.1030705@redhat.com> Date: Tue, 21 Oct 2014 13:24:21 +0200 From: Max Reitz MIME-Version: 1.0 References: <1413889440-32577-1-git-send-email-stefanha@redhat.com> <1413889440-32577-6-git-send-email-stefanha@redhat.com> In-Reply-To: <1413889440-32577-6-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 05/11] blockjob: add block_job_defer_to_main_loop() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Fam Zheng On 2014-10-21 at 13:03, Stefan Hajnoczi wrote: > Block jobs will run in the BlockDriverState's AioContext, which may not > always be the QEMU main loop. > > There are some block layer APIs that are either not thread-safe or risk > lock ordering problems. This includes bdrv_unref(), bdrv_close(), and > anything that calls bdrv_drain_all(). > > The block_job_defer_to_main_loop() API allows a block job to schedule a > function to run in the main loop with the BlockDriverState AioContext > held. > > This function will be used to perform cleanup and backing chain > manipulations in block jobs. > > Signed-off-by: Stefan Hajnoczi > --- > blockjob.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ > include/block/blockjob.h | 19 +++++++++++++++++++ > 2 files changed, 64 insertions(+) Reviewed-by: Max Reitz