From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agFS4-0005ko-79 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 13:41:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agFS3-00006t-CM for qemu-devel@nongnu.org; Wed, 16 Mar 2016 13:41:44 -0400 Sender: Paolo Bonzini References: <1455645388-32401-1-git-send-email-pbonzini@redhat.com> <1455645388-32401-8-git-send-email-pbonzini@redhat.com> <20160316163908.GA2012@stefanha-x1.localdomain> From: Paolo Bonzini Message-ID: <56E99ACC.3050904@redhat.com> Date: Wed, 16 Mar 2016 18:41:32 +0100 MIME-Version: 1.0 In-Reply-To: <20160316163908.GA2012@stefanha-x1.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 07/16] block: change drain to look only at one child at a time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org, qemu-block@nongnu.org On 16/03/2016 17:39, Stefan Hajnoczi wrote: > The tree looks like this: > > [NBD export] > / > v > [guest] temporary qcow2 > \ / > v v > disk > > Block backend access is in square brackets. Nodes without square > brackets are BDS nodes. > > If the guest wants to drain the disk, it's possible for new I/O requests > to enter the disk BDS while we're recursing to disk's children because > the NBD export socket fd is in the same AIOContext. The socket fd is > therefore handled during aio_poll() calls. > > I'm not 100% sure that this is a problem, but I wonder if you've thought > about this? I hadn't, but I think this is handled by using bdrv_drained_begin/bdrv_drained_end instead of bdrv_drain. The NBD export registers its callback as "external", and it is thus disabled between bdrv_drained_begin and bdrv_drained_end. It will indeed become more complex when BDSes won't have anymore a "home AioContext" due to multiqueue. I suspect that we should rethink the strategy for enabling and disabling external callbacks. For example we could add callbacks to each BlockBackend that enable/disable external callbacks, and when bdrv_drained_begin is called on a BDS, we call the callbacks for all BlockBackends that are included in this BDS. I'm not sure if there's a way to go from a BDS to all the BBs above it. Paolo