Received: from eggs.gnu.org ([2001:4830:134:3::10]:52667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoBIV-0004dk-U4 for qemu-devel@nongnu.org; Mon, 19 Oct 2015 10:20:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoBIO-0004Tb-G0 for qemu-devel@nongnu.org; Mon, 19 Oct 2015 10:20:21 -0400 From: Alberto Garcia In-Reply-To: <56228E1B.2020307@redhat.com> References: <8dc2b9b2a8c5307eba7fafa2dee8f6e8ef17a26c.1444743418.git.berto@igalia.com> <56228E1B.2020307@redhat.com> Date: Mon, 19 Oct 2015 16:20:13 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH 2/3] block: Add 'blockdev-del' QMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Markus Armbruster , qemu-block@nongnu.org On Sat 17 Oct 2015 08:06:19 PM CEST, Max Reitz wrote: >> + if (blk_get_refcnt(blk) > 1 || >> + (bs && (bs->refcnt > 1 || !QLIST_EMPTY(&bs->parents)))) { >> + error_setg(errp, "Block device %s is being used", device); >> + goto out; >> + } > > I can't think of a way off the top of my head that a BB with a refcount > of one or a BDS with a refcount of one without any parents would not be > monitor-owned, but I don't quite like assuming it just from the refcount > and the parent list anyway. I agree, I would also like to have a clearer way to do it. I'll try to go over all possible ways to create a BDS and see other cases that I might have missed. At the very list I would like to extend the iotest and make it as comprehensive as possible. > The two patches which are significant for this patch are: > - "blockdev: Keep track of monitor-owned BDS" from the first series > - "blockdev: Add list of monitor-owned BlockBackends" from the second > > Explaining what they do and why they are relevant to this patch doesn't > really seem necessary, but anyway: They add one list for the > monitor-owned BDSs and one for the monitor-owned BBs. Yeah, those would be handy indeed. > It's up to you. It probably works just how you implemented it, and > considering the pace of the "BB and media" series (and other series of > mine in the past year), getting those two series merged may be a > matter of decades. So it's probably best to do it like this for now > and I'll fix it up then... I think I'll first try to go over all possible cases and see what I find. Thanks, Berto