From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3fP6-0004fw-Nx for qemu-devel@nongnu.org; Fri, 20 May 2016 04:03:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3fP5-00008r-R3 for qemu-devel@nongnu.org; Fri, 20 May 2016 04:03:28 -0400 Date: Fri, 20 May 2016 10:03:17 +0200 From: Kevin Wolf Message-ID: <20160520080317.GA4861@noname.redhat.com> References: <1463559850-5244-1-git-send-email-famz@redhat.com> <1463559850-5244-2-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1463559850-5244-2-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/3] blockdev-backup: Don't move target AioContext if it's attached List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, Max Reitz , Markus Armbruster , Stefan Hajnoczi , "Michael S. Tsirkin" , Paolo Bonzini , qemu-block@nongnu.org Am 18.05.2016 um 10:24 hat Fam Zheng geschrieben: > If the BDS is attached, it will want to stay on the AioContext where its > BlockBackend is. Don't call bdrv_set_aio_context in this case. > > Signed-off-by: Fam Zheng > --- > blockdev.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/blockdev.c b/blockdev.c > index 1892b8e..eb15593 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -3376,8 +3376,18 @@ void do_blockdev_backup(const char *device, const char *target, > } > target_bs = blk_bs(target_blk); > > + if (bdrv_get_aio_context(target_bs) != aio_context) { > + if (!target_bs->blk) { How should this ever happen when we have target_bs = blk_bs(target_blk) two lines above? > + /* The target BDS is not attached, we can safely move it to another > + * AioContext. */ > + bdrv_set_aio_context(target_bs, aio_context); > + } else { > + error_setg(errp, "Target is attached to a different thread from " > + "source."); > + goto out; > + } > + } Kevin