mdev race conditions

Denys Vlasenko vda.linux at googlemail.com
Tue Jun 3 15:58:32 UTC 2008


On Tuesday 03 June 2008 16:44, Bernard Blackham wrote:
> Hi,
> 
> When I switched from udev+udevd to mdev, booting was much faster and it 
> shaved a decent amount from the total image size. However, I've recently 
> noticed device nodes sometimes disappearing on boot. The specific 
> scenario is:
> 
> 1. /dev/ttyS1 exists as a device node in the filesystem on boot - prior 
> to the actual device existing, and prior to mdev being called.
> 
> 2. echo /bin/mdev > /proc/sys/kernel/hotplug
> 
> 3. a module is loaded that provides ttyS1
> 
> When this module is loaded, most of the time the existing ttyS1 remains. 
> Sometimes however, it is unlinked from the filesystem and is never seen 
> again (until mdev -s is run, or next boot, maybe).
> 
> I pointed my hotplug to a script to log what mdev was being called as, 
> and found that when the module is loaded, there is actually a remove 
> event emitted followed by an add event. As there is no locking with 
> mdev, sometimes mdev runs the remove after the add and thus the device 
> node goes missing.
> 
> udev seems to have gotten around this using a daemon that serialises 
> events based on the sequence number provided by the kernel.

How these event seq numbers are passed? Some env variable?
--
vda



More information about the busybox mailing list