From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56505 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4eQn-0007BL-DT for qemu-devel@nongnu.org; Tue, 29 Mar 2011 15:18:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4eFC-00019Q-AW for qemu-devel@nongnu.org; Tue, 29 Mar 2011 15:06:24 -0400 Received: from mtagate6.uk.ibm.com ([194.196.100.166]:34632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4eFC-000197-0e for qemu-devel@nongnu.org; Tue, 29 Mar 2011 15:06:22 -0400 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate6.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p2TJ6Kl5014185 for ; Tue, 29 Mar 2011 19:06:20 GMT Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2TJ6qwm1970228 for ; Tue, 29 Mar 2011 20:06:54 +0100 Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2TJ6H7M008049 for ; Tue, 29 Mar 2011 13:06:17 -0600 From: Stefan Hajnoczi Date: Tue, 29 Mar 2011 20:04:39 +0100 Message-Id: <1301425482-8722-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2 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 , Juan Quintela 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. v2: * Clarify cdrom_is_inserted() comment as per Juan's suggestion