Hi Denys,

On Mon, Sep 19, 2011 at 01:31:18PM +0200, Denys Vlasenko wrote:
> On Mon, Sep 19, 2011 at 1:26 PM, Baruch Siach <[email protected]> wrote:
> > On Mon, Sep 19, 2011 at 12:12:47PM +0200, Denys Vlasenko wrote:
> >> On Fri, Sep 16, 2011 at 11:05 AM, Baruch Siach <[email protected]> wrote:
> >> > Hi Walter,
> >> >
> >> > On Wed, Sep 14, 2011 at 11:55:08PM -0400, Walter Dnes wrote:
> >> >
> >> > [snip]
> >> >
> >> >>   Gentoo has /bin/busybox as part of the default system.  There is also
> >> >> an option to build busybox with libraries statically linked.  IANAPP
> >> >> (I Am Not A Professional Programmer), but I can do quite a bit of bash
> >> >> scripting etc.  In Gentoo, the user generally knows what peripherals he
> >> >> has permanently connected to the machine.  Plus you'll get the usual USB
> >> >> keys and external drives being hooked up occasionally.
> >> >>
> >> >>   If mdev can replace udev a lot of Gentoo users would be very happy.
> >> >> You might even have to start a separate "mdev-users" list <G>.
> >> >
> >> > I haven't seen a mention of the inherently racy nature of the hotplug
> >> > mechanism on which mdev relies. Below is an explanation taken from
> >> > http://www.kernel.org/doc/pending/hotplug.txt (down at the moment).
> >> >
> >> > <quote>
> >> >
> >> > A note about race conditions (or "why bother with netlink?"):
> >> > =============================================================
> >> ...
> >> > In theory, transient devices (which are created and removed again almost
> >> > instantly, which can be caused by poorly written drivers that fail their
> >> > device probe) could have similar "leftover" /dev entries from the
> >> > /sbin/hotplug mechanism.  (If two processes are spawned simultaneously, 
> >> > which
> >> > one completes first is not guaranteed.)  This is not common, but 
> >> > theoretically
> >> > possible.
> >>
> >> $SEQNUM thing is supposed to take care of that, no?
> >
> > AFAIK, there is no robust way for the mdev running on $SEQNUM == N to know
> > whether the one doing $SEQNUM == N-1 has finished its business.
> 
> Nothing is 100.000000000000000000000000000000% robust.
> /dev/mdev.seq is not robust enough for you?

The netlink based solution looks more robust and more elegant to me.

> > [snip]
> >
> >> If /dev/mdev.seq file exists, mdev will wait for its value
> >> to match $SEQNUM variable. This prevents plug/unplug races.
> >
> > This assumes that the mdev of $SEQNUM == N-1 had a chance to run and update
> > (or create) the /dev/mdev.seq file before the mdev doing $SEQNUM == N read 
> > it.
> > What happens when the mdev of N-1 dies before updating mdev.seq?
> 
> Next mdev will run after 2 second timeout.

This might break when the N-1 mdev is waiting for CPU to run (e.g. a badly 
designed application with many high priority processes contending for CPU, 
while the mdev processes starve).

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to