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