From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrO1S-0004Gx-Jn for qemu-devel@nongnu.org; Thu, 20 Nov 2014 04:27:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrO1L-0000Ya-Iq for qemu-devel@nongnu.org; Thu, 20 Nov 2014 04:27:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrO1L-0000Xf-BY for qemu-devel@nongnu.org; Thu, 20 Nov 2014 04:27:23 -0500 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 sAK9RLYE006960 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 20 Nov 2014 04:27:22 -0500 Message-ID: <546DB3F7.1060708@redhat.com> Date: Thu, 20 Nov 2014 10:27:19 +0100 From: Max Reitz MIME-Version: 1.0 References: <1416406785-14241-1-git-send-email-stefanha@redhat.com> <1416406785-14241-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1416406785-14241-4-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 for-2.3 3/4] blockdev: acquire AioContext in eject, change, and block_passwd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf On 2014-11-19 at 15:19, Stefan Hajnoczi wrote: > By acquiring the AioContext we avoid race conditions with the dataplane > thread which may also be accessing the BlockDriverState. > > Fix up eject, change, and block_passwd in a single patch because > qmp_eject() and qmp_change_blockdev() both call eject_device(). Also > fix block_passwd while we're tackling a command that takes a block > encryption password. > > Signed-off-by: Stefan Hajnoczi > --- > blockdev.c | 36 +++++++++++++++++++++++++++++------- > hw/block/dataplane/virtio-blk.c | 1 + > 2 files changed, 30 insertions(+), 7 deletions(-) You could've used blk_get_aio_context() for acquiring the AioContext in qmp_eject() instead of in eject_device() (and qmp_change_blockdev(), which is the other caller of eject_device(), holds the context anyway). Anyway: Reviewed-by: Max Reitz