Bug 34710 — CD-ROM polling failed due to O_EXCL flag
authorMartin Pitt <martin.pitt@ubuntu.com>
Sun, 19 Jun 2011 18:48:22 +0000 (20:48 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Tue, 21 Jun 2011 17:04:55 +0000 (19:04 +0200)
commit2d0272eb3be71f6ee3f52c55a3d608764b675fb0
treea01acc919fce9d8ba4e2e722ba9591db01914f24
parent1c7d933431e49ff6840a388eb23134633155a442
Bug 34710 — CD-ROM polling failed due to O_EXCL flag

Newer kernels (2.6.38+) support in-kernel polling of CD-ROM/SD card devices.
udev 172 and later enable this feature by default:

  http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=c5a41da949

That will also handle the eject button properly and send out remove uevents,
which causes stale mounts to be cleaned up properly.

In-kernel polling avoids the userspace race conditions with accessing the
drive.

If kernel polling is not supported or enabled, fall back to the previous method
of unlocking the CD drive door right after mounting, to keep the hardware
button working.
src/device-private.h
src/device.c
src/poller.c