race between SCSI uevents and media detection

From: Bill Nottingham
Date: Wed Mar 19 2008 - 19:11:46 EST


For a typical livecd boot using udev, you'd check for the root device
with a udev rule like:

KERNEL=="sr[0-9]", PROGRAM=="/lib/udev/vol_id -l %N", RESULT="<some label>",
SYMLINK+="root"

This creates a /dev/root symlink to whichever CD device holds the proper
CD/DVD.

However, this currently fails repeatedly on some machines, as the run
of vol_id gets ENOMEDIUM attempting to open the CD device. I suspect
this is because the initial medium scan is actually done after the
uevent for /dev/sr0 is emitted.

Can the open path be fixed to block until the medium state is initially
known? I don't see how this can be worked around from userspace - you
don't get another uevent for the media detection.

Bill
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/