[systemd-devel] cdrom_id opens device with O_EXCL, why?

Hoyer, Marko (ADITG/SW2) mhoyer at de.adit-jv.com
Wed Sep 17 23:22:15 PDT 2014


Hello together,

I recently stumbled over cdrom_id opening the device with the O_EXCL flag set, if it is not currently mounted:

"fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL));"

The effect of this is that automatically mounting a cdrom sometimes results in "resource busy", if "change" uevents of the devices are processed by udevd while the automounter (udisks or something different in my case) is currently trying to mount the device triggered by a previous "add" or "change" uevent.

I've to questions to this issue. Maybe someone of you can help me:

1. Is there any particular reason why cdrom_id should open the device exclusively (especially since it is not opened exclusively when it is already mounted)?

2. If there is any good reason to keep this behavior: How is the best way for an automounter to deal with this? Retry? Something different? 


Thx in advance for valuable input.


Best regards

Marko Hoyer

Advanced Driver Information Technology GmbH
Software Group II (ADITG/SW2)
Robert-Bosch-Str. 200
31139 Hildesheim
Germany

Tel. +49 5121 49 6948
Fax +49 5121 49 6999
mhoyer at de.adit-jv.com

ADIT is a joint venture company of Robert Bosch GmbH/Robert Bosch Car Multimedia GmbH and DENSO Corporation
Sitz: Hildesheim, Registergericht: Amtsgericht Hildesheim HRB 3438
Geschaeftsfuehrung: Wilhelm Grabow, Katsuyoshi Maeda


More information about the systemd-devel mailing list