On Fri, Apr 08, 2011 at 12:33:27PM +0100, Stefan Hajnoczi wrote:
> Amit and I were discussing the pros and cons of using O_EXCL to open
> host CD-ROM devices on IRC but this discussion could benefit from more
> input.
> 
> Linux block devices (like /dev/sr0 CD-ROMs) can be opened with O_EXCL
> and only one userspace process will succeed at a time.  This prevents
> programs from interfering with each other.  The polling daemons, hald
> and udisks, use O_EXCL and mount does too.
> 
> Today QEMU does not use O_EXCL and will therefore access host CD-ROMs
> while they are in use by other programs.  This also means that
> programs can be started on the host while QEMU is already running that
> may interfere with the virtual machine's ability to access the CD-ROM
> (for example by ejecting it).
> 
> Therefore, it sounds reasonable to switch to O_EXCL to prevent
> interfering with other programs and to prevent other programs
> interfering with QEMU.

This all boils down to whether qemu should allow concurrent access
to image files of all sorts, and there are arguments both ways:

 pro: prevents corruption problems on disk images, notification issues
      on CDROMS, etc
 contra: makes clustering not work

which means we need it configurable.  I'd prefer to have the exclusion
on by default, but people caring for backwards comptibility might argue
the other way around.  Either way it needs to be consistent for both
devices and file images.

Reply via email to