probe-storage and addon-storage competing for O_EXCL on cdrom device

kareemy kareemy at gmail.com
Wed Mar 7 18:34:57 PST 2007


I am attaching a quick patch I wrote based on retry code in
hal-storage-shared.c. This patch appears to solve the problem for me,
but I've only tested it a few times on my own machine.

On 3/7/07, kareemy <kareemy at gmail.com> wrote:
> I am trying hal 0.5.9rc1 and have had a problem where most of the times when I insert a new cdrom disk into my cdrom, no volume namespace is created for the cd. I did some debugging and found out this happens when open (device_file, ORDONLY | O_NONBLOCK | O_EXCL) fails and sets EBUSY in  probe-storage.c around line 287.
>
> Inside the EBUSY if conditional, hal correctly determines that the device is not mounted and then does a goto out, so it never opens the device and never setups a volume namespace or anything like that.
>
> I added some debugging output to probe-storage.c and addon-storage.c that prints when each one successfully opens the device and then closes it again. A lot of times on my system, addon-storage.c does a O_EXCL on the cdrom device, probe-storage attempts an O_EXCL and fails, then addon-storage closes the device.
>
> I'm attaching a log of hald --daemon=no --verbose=yes with my additional debugging comments that illustrates this. At the beginning of the file, it shows addon-storage polling the cdrom device every 2 seconds as usual, then once I insert a new media, addon-storage locks the cdrom, probe-storage trys to do an open, it fails, and then addon-storage closes the lock.
>
> I figure it is possible to have probe-storage keep trying if it gets an EBUSY error until it can open the device, but I'm not sure if that is the best solution. Ideas?
>
> Some more system specs:
> Linux  2.6.19.2 SMP
> Hal 0.5.9rc1
> dbus 1.0.2
>
> - Kareem Dana
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdrom-oexcl.patch
Type: application/octet-stream
Size: 1583 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20070307/46e47e6e/cdrom-oexcl.obj


More information about the hal mailing list