From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RK3dA-0007PF-Lt for qemu-devel@nongnu.org; Sat, 29 Oct 2011 03:47:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RK3d9-0001tC-Nw for qemu-devel@nongnu.org; Sat, 29 Oct 2011 03:47:04 -0400 Received: from lo.gmane.org ([80.91.229.12]:39156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RK3d9-0001t2-HX for qemu-devel@nongnu.org; Sat, 29 Oct 2011 03:47:03 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RK3d7-0000rs-Ry for qemu-devel@nongnu.org; Sat, 29 Oct 2011 09:47:01 +0200 Received: from 93-34-199-98.ip51.fastwebnet.it ([93.34.199.98]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 29 Oct 2011 09:47:01 +0200 Received: from pbonzini by 93-34-199-98.ip51.fastwebnet.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 29 Oct 2011 09:47:01 +0200 From: Paolo Bonzini Date: Sat, 29 Oct 2011 09:46:50 +0200 Message-ID: References: <1319540020-32484-1-git-send-email-pbonzini@redhat.com> <1319540020-32484-7-git-send-email-pbonzini@redhat.com> <4EAAE4A0.7090507@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit In-Reply-To: <4EAAE4A0.7090507@redhat.com> Subject: Re: [Qemu-devel] [PATCH 6/8] block: add eject request callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 10/28/2011 07:21 PM, Kevin Wolf wrote: >> > - if (!force&& !bdrv_dev_is_tray_open(bs) >> > -&& bdrv_dev_is_medium_locked(bs)) { >> > - qerror_report(QERR_DEVICE_LOCKED, bdrv_get_device_name(bs)); >> > + if (bdrv_dev_is_medium_locked(bs)&& !bdrv_dev_is_tray_open(bs)) { >> > + bdrv_dev_eject_request(bs, force); >> > + if (!force) { >> > + qerror_report(QERR_DEVICE_LOCKED, bdrv_get_device_name(bs)); >> > + } >> > return -1; >> > } >> > bdrv_close(bs); > Now force doesn't force any more. It avoids the error message, but > doesn't forcefully close the BlockDriverState any more. Intentional? If > so, why is it a good idea? In theory the guest OS should eject the disk itself. However, force does unlock the disk so that: 1) two ejects will have the desired effect; 2) force eject followed by change will work even with the tray locked, unlike before this series. Paolo