Received: from eggs.gnu.org ([2001:4830:134:3::10]:56929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS5lM-0008Kv-7V for qemu-devel@nongnu.org; Thu, 11 Sep 2014 10:54:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XS5lD-0002mN-Lv for qemu-devel@nongnu.org; Thu, 11 Sep 2014 10:54:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS5lD-0002lt-Fh for qemu-devel@nongnu.org; Thu, 11 Sep 2014 10:54:11 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8BEsAE0011697 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 11 Sep 2014 10:54:10 -0400 Date: Thu, 11 Sep 2014 16:54:08 +0200 From: Kevin Wolf Message-ID: <20140911145408.GG3891@noname.redhat.com> References: <1410446739-27662-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1410446739-27662-1-git-send-email-armbru@redhat.com> Subject: Re: [Qemu-devel] [PATCH] blockdev: Refuse to drive_del something added with blockdev-add List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, stefanha@redhat.com Am 11.09.2014 um 16:45 hat Markus Armbruster geschrieben: > For some device models, the guest can prevent unplug. Some users need a > way to forcibly revoke device model access to the block backend then, so > the underlying images can be safely used for something else. > > drive_del lets you do that. Unfortunately, it conflates revoking access > with destroying the backend. > > Commit 9063f81 made drive_del immediately destroy the root BDS. Nice: > the device name becomes available for reuse immediately. Not so nice: > the device model's pointer to the root BDS dangles, and we're prone to > crash when the memory gets reused. > > Commit d22b2f4 fixed that by hiding the root BDS instead of destroying > it. Destruction only happens on unplug. "Hiding" means removing it > from bdrv_states and graph_bdrv_states; see bdrv_make_anon(). > > This "destroy on revoke" is a misfeature we don't want to carry > forward to blockdev-add, just like "destroy on unplug" (commit > 2d246f0). So make drive_del fail on anything added with blockdev-add. > > We'll add separate QMP commands to revoke device model access and to > destroy backends. > > Signed-off-by: Markus Armbruster Oops, was this still missing? I've been meaning to forbid this since we introduced blockdev-add, but apparently never got around to doing it. Thanks, applied to the block branch. Kevin