From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bx9Nr-00052k-GP for qemu-devel@nongnu.org; Thu, 20 Oct 2016 05:11:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bx9Nq-00088z-Ir for qemu-devel@nongnu.org; Thu, 20 Oct 2016 05:11:31 -0400 Date: Thu, 20 Oct 2016 11:11:21 +0200 From: Kevin Wolf Message-ID: <20161020091121.GA5211@noname.redhat.com> References: <99a0ff7379a345ed60a6092866c9a42f667b37b5.1476450059.git.berto@igalia.com> <20161019171120.GH5336@noname.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v11 01/19] block: Add bdrv_drain_all_{begin, end}() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Eric Blake , Max Reitz , Markus Armbruster , pbonzini@redhat.com, jsnow@redhat.com Am 20.10.2016 um 10:25 hat Alberto Garcia geschrieben: > On Wed 19 Oct 2016 07:11:20 PM CEST, Kevin Wolf wrote: > >> bdrv_drain_all() doesn't allow the caller to do anything after all > >> pending requests have been completed but before block jobs are > >> resumed. > >> > >> This patch splits bdrv_drain_all() into _begin() and _end() for that > >> purpose. It also adds aio_{disable,enable}_external() calls to > >> disable external clients in the meantime. > >> > >> Signed-off-by: Alberto Garcia > > > > This looks okay as a first step, possibly enough for this series > > (we'll have to review this carefully), but it leaves us with a rather > > limited version of bdrv_drain_all_begin/end that excludes many useful > > cases. One of them is that John wants to use it around QMP > > transactions. > > > > Specifically, you can't add a new BDS or a new block job in a > > drain_all section because then bdrv_drain_all_end() would try to > > unpause the new thing even though it has never been paused. Depending > > on what else we did with it, this will either corrupt the pause > > counters or just directly fail an assertion. > > The problem is: do you want to be able to create a new block job and let > it run? Because then you can end up having the same problem that this > patch is trying to prevent if the new job attempts to reopen a > BlockDriverState. No, as I wrote it would have to be automatically paused on creation if it is created in a drained_all section. It would only actually start to run after bdrv_drain_all_end(). Kevin