From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XaWXs-0007uZ-Iw for qemu-devel@nongnu.org; Sat, 04 Oct 2014 17:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XaWXm-0000AU-Es for qemu-devel@nongnu.org; Sat, 04 Oct 2014 17:07:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XaWXm-0000AQ-8F for qemu-devel@nongnu.org; Sat, 04 Oct 2014 17:07:10 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s94L79g5018276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sat, 4 Oct 2014 17:07:09 -0400 Message-ID: <54306179.8030901@redhat.com> Date: Sat, 04 Oct 2014 23:07:05 +0200 From: Max Reitz MIME-Version: 1.0 References: <1412182919-9550-1-git-send-email-stefanha@redhat.com> <1412182919-9550-10-git-send-email-stefanha@redhat.com> In-Reply-To: <1412182919-9550-10-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 09/11] block: let mirror blockjob run in BDS AioContext 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 01.10.2014 19:01, Stefan Hajnoczi wrote: > The mirror block job must run in the BlockDriverState AioContext so that > it works with dataplane. > > Acquire the AioContext in blockdev.c so starting the block job is safe. > > Note that to_replace is treated separately from other BlockDriverStates > in that it does not need to be in the same AioContext. Explicitly > acquire/release to_replace's AioContext when accessing it. > > The completion code in block/mirror.c must perform BDS graph > manipulation and bdrv_reopen() from the main loop. Use > block_job_defer_to_main_loop() to achieve that. > > The bdrv_drain_all() call is not allowed outside the main loop since it > could lead to lock ordering problems. Use bdrv_drain(bs) instead > because we have acquired the AioContext so nothing else can sneak in > I/O. > > Signed-off-by: Stefan Hajnoczi > --- > block.c | 13 +++++++-- > block/mirror.c | 85 ++++++++++++++++++++++++++++++++++++++++------------------ > blockdev.c | 38 ++++++++++++++++++-------- > 3 files changed, 97 insertions(+), 39 deletions(-) Reviewed-by: Max Reitz