From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlv7N-0006XN-Rf for qemu-devel@nongnu.org; Tue, 13 Oct 2015 04:39:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zlv7K-0006mi-2d for qemu-devel@nongnu.org; Tue, 13 Oct 2015 04:39:33 -0400 Date: Tue, 13 Oct 2015 10:39:22 +0200 From: Kevin Wolf Message-ID: <20151013083922.GB4906@noname.str.redhat.com> References: <1444392941-28704-1-git-send-email-kwolf@redhat.com> <1444392941-28704-14-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v3 13/16] block: Implement bdrv_append() without bdrv_swap() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: famz@redhat.com, qemu-block@nongnu.org, jcody@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com Am 12.10.2015 um 16:27 hat Alberto Garcia geschrieben: > On Fri 09 Oct 2015 02:15:38 PM CEST, Kevin Wolf wrote: > > +static void change_parent_backing_link(BlockDriverState *from, > > + BlockDriverState *to) > > +{ > > + BdrvChild *c, *next; > > + > > + QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) { > > + assert(c->role != &child_backing); > > + c->bs = to; > > + QLIST_REMOVE(c, next_parent); > > + QLIST_INSERT_HEAD(&to->parents, c, next_parent); > > + bdrv_ref(to); > > + bdrv_unref(from); > > + } > > + if (from->blk) { > > + blk_set_bs(from->blk, to); > > + if (!to->device_list.tqe_prev) { > > + QTAILQ_INSERT_BEFORE(from, to, device_list); > > + } > > Is it even possible that this last condition is false? In what case > would 'to' be already in bdrv_states? > > I understand that it would mean that it would already be attached to a > BlockBackend, but that's not possible in this case. Yes, I think it's not possible currently (hopefully, because that would cause other bugs), just being careful. Eventually we'll allow more than one BlockBackend pointing to the same BDS, and then this is a scenario that could happen. Kevin