Received: from eggs.gnu.org ([2001:4830:134:3::10]:49699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WV0va-00020W-5b for qemu-devel@nongnu.org; Tue, 01 Apr 2014 11:48:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WV0vT-0004aN-W5 for qemu-devel@nongnu.org; Tue, 01 Apr 2014 11:48:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WV0vT-0004a6-No for qemu-devel@nongnu.org; Tue, 01 Apr 2014 11:48:35 -0400 From: Markus Armbruster References: <1396360537-12520-1-git-send-email-graalfs@linux.vnet.ibm.com> Date: Tue, 01 Apr 2014 17:48:27 +0200 In-Reply-To: <1396360537-12520-1-git-send-email-graalfs@linux.vnet.ibm.com> (Heinz Graalfs's message of "Tue, 1 Apr 2014 15:55:37 +0200") Message-ID: <87eh1h8304.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] drive_del vs. device_del: what should come first? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Heinz Graalfs Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Heinz Graalfs writes: > Hi Kevin, > > doing a > > virsh detach-device ... > > ends up in the following QEMU monitor commands: > > 1. device_del ... > 2. drive_del ... > > qmp_device_del() performs the device unplug path. > In case of a block device do_drive_del() tries to > prevent further IO against the host device. > > However, bdrv_find() during drive_del() results in > an error, because the device is already gone. Due to > this error all the bdrv_xxx calls to quiesce the block > driver as well as all other processing is skipped. > > Is the sequence that libvirt triggers OK? > Shouldn't drive_del be executed first? No. drive_del is nasty. Its purpose is to revoke access to an image even when the guest refuses to cooperate. To the guest, this looks like hardware failure. If you drive_del before device_del, even a perfectly well-behaved guest guest is exposed to a terminally broken device between drive_del and completion of unplug. Always try a device_del first, and only if that does not complete within reasonable time, and you absolutely must revoke access to the image, then whack it over the head with drive_del.