From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59415 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2UwV-0004Xg-KH for qemu-devel@nongnu.org; Wed, 23 Mar 2011 16:46:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2UwU-000471-Hy for qemu-devel@nongnu.org; Wed, 23 Mar 2011 16:46:11 -0400 Received: from mtagate7.uk.ibm.com ([194.196.100.167]:45515) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2UwU-00046s-4h for qemu-devel@nongnu.org; Wed, 23 Mar 2011 16:46:10 -0400 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate7.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p2NHfKS3015444 for ; Wed, 23 Mar 2011 17:41:20 GMT Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2NHfmNm1945710 for ; Wed, 23 Mar 2011 17:41:48 GMT Received: from d06av10.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2NHfK52016726 for ; Wed, 23 Mar 2011 11:41:20 -0600 From: Stefan Hajnoczi Date: Wed, 23 Mar 2011 17:40:52 +0000 Message-Id: <1300902055-25850-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 0/3] block: Correct size across CD-ROM media change List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Amit Shah , Anthony Liguori , Ryan Harper This patch series fixes two Linux host CD-ROM pass-through bugs in QEMU. After applying these patches it is possible to pass-through a Linux host CD-ROM completely. The guest can eject from software or the physical eject button can be pressed on the drive. The guest can detect this and newly inserted media are noticed. There is no need to issue any QEMU monitor 'eject' or 'change' commands because the host CD-ROM is completely "passed through". Patch details: The first is that the device size is cached even for removable devices and we never update it. If a host CD-ROM is changed, then the size will be stale and reflect that of the last medium. The second is that Linux host CD-ROM pass-through requires that we re-open the device to refresh its size. This is because the Linux CD-ROM driver only refreshes the size when the device is opened and furthermore has a bug that leads to stale sizes if the file descriptor is held across media change. I have also included a trace event for bdrv_set_locked() because it is useful information when debugging issues like these in the future.