From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai3ef-0003Pa-LC for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:30:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ai3eZ-0001W4-Pc for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:30:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai3eZ-0001Vh-JF for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:30:07 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 4863CC00358F for ; Mon, 21 Mar 2016 17:30:07 +0000 (UTC) References: <1456151945-11225-1-git-send-email-pbonzini@redhat.com> <1456151945-11225-2-git-send-email-pbonzini@redhat.com> <87a8lr27b7.fsf@blackfin.pond.sub.org> <56F013EF.1000401@redhat.com> <8737rj7npp.fsf@blackfin.pond.sub.org> From: Paolo Bonzini Message-ID: <56F02F9B.9040305@redhat.com> Date: Mon, 21 Mar 2016 18:30:03 +0100 MIME-Version: 1.0 In-Reply-To: <8737rj7npp.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] block: detach devices from DriveInfo at unrealize time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz On 21/03/2016 18:19, Markus Armbruster wrote: >> > >> > The other possibility is to make blk_detach_dev do nothing if blk->dev >> > == NULL, i.e. make it idempotent. On one hand, who doesn't like >> > idempotency; on the other hand, removing an assertion is also dirty. >> > >> > I chose the easy way here (changing as fewer contracts as possible). > Why can't we keep the work in the property release() method > release_drive()? > > The only reason blockdev_mark_auto_del() isn't there is that the device > decides whether to call it, not the property. DEVICE_DELETED is currently sent right after setting unrealized to false (see device_unparent), and you cannnot send it later than that. In particular release_drive would mean sending the drive when properties are removed in instance_finalize; by that time you don't have anymore a QOM path to include in the event. Paolo