Fix for SuSE multiple hotplug network interfaces race condition?

From: Dan Harkless (usenet_at_harkless.org)
Date: 08/02/03


Date: 1 Aug 2003 23:44:39 -0700

In SuSE 8.2, all USB and PCMCIA network interface hotplug events are
funneled through a single 1-line file, /var/run/hotplug/net. As
alluded to in /etc/sysconfig/hotplug, this causes serious race
condition problems if you have more than one hotplug network
interface:

> # At the moment we write HW descriptions at USB or PCI hotplug events, which
> # then can be read by the NET event. This may cause race conditions if you
> # plug several deveices at a time.

There's a hack in /sbin/hotplug to attempt to serialize USB network
interface hotplug events, but it doesn't always work. And there's not
even an attempt to serialize PCMCIA network interface hotplug events.

My company is developing an embedded Linux device, and during our
deployment test phase, we need to be able to boot the box (note it
must be at boot time -- we can't require an operator to plug in
devices one at a time) with four hotplug network interfaces attached:

    1. Belkin F5D5050 on mobo's USB 1.1 port 1
    2. Belkin F5D5050 on mobo's USB 1.1 port 2
    3. Belkin F5D5050 on PCMCIA USB 2.0 card
    4. IBM Token-Ring PCMCIA card

(These are in addition to a non-hotplug Ethernet interface built into
the motherboard.)

With SuSE's versions of the hotplug scripts, where all four of those
interfaces want to overwrite the the /var/run/hotplug/net file, with
unpredictable timing between them, often some interfaces won't come up
at boot time, and/or the system will freeze in the middle of a
shutdown/reboot because the race condition caused incorrect
information to get written to /var/run/hotplug/*remover* scripts.

Why are SuSE's hotplug scripts written this way? The copies of the
scripts on my Red Hat 9 system and at
<http://linux-hotplug.sourceforge.net/> don't use a
/var/run/hotplug/net file...

Has anyone made any attempts to fix the race conditions in the SuSE
system? I looked at the scripts for a long time and tried a few
things, but I couldn't see how to fix them, since the net.agent script
gets launched in parallel with the usb.agent and/or pci.agent scripts
(possibly multiple invocations of each), and there doesn't seem to be
any environment variables or commandline parameters available that
would allow you to match up a given net.agent script with its correct
usb.agent / pci.agent brother.

Oh, and one more question (sorry). Just above the lines I quoted
above from /etc/sysconfig/hotplug appear the lines:

> # In future hotplug will hopefully be able to know which piece of hardware is
> # behind a given network interface. But currently there is no easy way to get
> # this information easily.

"No easy way to get it easily" implies that it's possible, but hard.
;^> How can one relate the USB bus + port information seen in
/proc/bus/usb/devices to a given logical network interface name like
eth1, if you have multiple USB devices using the same driver?

--
Dan Harkless
usenet@harkless.org
http://harkless.org/dan/


Relevant Pages

  • Fix for SuSE multiple hotplug network interfaces race condition?
    ... all USB and PCMCIA network interface hotplug events are ... even an attempt to serialize PCMCIA network interface hotplug events. ... Why are SuSE's hotplug scripts written this way? ...
    (alt.os.linux.suse)
  • Re: Network Interfaces
    ... I have never used usb but I do use a wireless pcmcia card in my laptop. ... iface lo inet loopback ... iface eth0 inet dhcp ...
    (Debian-User)
  • USB RNDIS and no Device Notifications
    ... Notification queue to "listen to" all the devices that get plugged/ ... removed from the machine, it's working great for USB printers, USB / ... receive any notification in my listening queue. ... usual notifications system when creating the network interface. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: arp table - Newbie
    ... Since the problem gone after server reboot, there must be scripts to ... restart the network interface. ... ifconfigcan be used to shut them down and restart them. ...
    (comp.unix.solaris)
  • Re: Accessing USB ports
    ... There has to be a device on each end of a USB ... For current PC USB ports there has to be a slave device on the ... Linux knows about (e.g. serial port, network interface, mass ... You can't connect two hosts to each other using ...
    (comp.os.linux.hardware)