mdev race conditions

Denys Vlasenko vda.linux at googlemail.com
Wed Jun 4 08:41:38 UTC 2008


On Wednesday 04 June 2008 02:43, Bernard Blackham wrote:
> Mike Frysinger wrote:
> > you'll also need to make sure you do this somewhere which has temporary 
> > storage ... otherwise you'll wreck embedded flash systems
> 
> /dev is on tmpfs anyway.
> 
> > *shrug* anything not daemon/netlink based looks like a hack to me
> 
> And I'm inclined to agree.
> 
>  > which means i still dont understand why people dont go use udevd if
>  > they need a real setup.
> 
> s/real/reliable/
> 
> What good is using mdev if it cannot be relied upon? (apart from using 
> mdev -s at boot and an otherwise completely-static /dev).

Try attached 2.patch. It adds mdev options -f SEQFILE and -t TIMEOUT_MSEC.
If -f is not given, the behavious is unchanged.

If -f SEQFILE is given, and if SEQNUM env var is set, mdev will check
whether SEQFILE contains exactly the same line as $SEQNUM
(must match exactly, not even '\n' is allowed to be there).
It will proceed immediately if file can't be read.
It will time out (default 1000 msec) and proceed
even if SEQFILE contains non-matching line.

After mdev is done, and if both -f was given and $SEQNUM is set,
mdev will write $SEQNUM + 1 to SEQFILE prior to exit.

Note that if SEQFILE is not absolute, it will be read/written relative to /dev.

Only compile tested...
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-diff
Size: 2612 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080604/84f7bd4d/attachment.bin 


More information about the busybox mailing list