mmm... I had to do a bit of mangling in the net core to be able
to "reserve" the netdevice name at init_etherdev() time, but make
it unavailable in namespace lookups.
As Jeff points out, it was an unusual interface - a two-phase
registration where we first reserve the name and then later
either commit it or withdraw it. That's not the way kernel
normally does things, and it was done that way for back-compatibility,
and to make the device naming prettier.
And yes, it was a 140k patch because it modified about eighty drivers,
pulled out the old interfaces and pulled out dev_probe_lock().
> > I'm all for removing it... I do not like removing it in a so-called
> > "stable" series, though. alloc_etherdev() was enough to solve the race
> > and flush out buggy drivers using dev->name during probe. Notice I did
> > not remove init_etherdev and fix it properly -- IMHO that is 2.5
> > material.
>
> Nope, guy. Fixing fatal bug is always material of released kernel.
>
> In any case the question remains: what is the sense of dev_probe_lock now?
It protects the as-yet-unchanged PCI and Cardbus drivers from a
fatal race.
This is not some theoretical race, BTW: as an experiment I put
a simple "schedule()" into vortex_probe1() and it killed the
driver. Because:
sys_init_module()
->vortex_probe1()
->init_etherdev()
->register_netdev()
->/sbin/hotplug (an asynchronous execve)
-> ifconfig eth0 up
ifconfig is executed before vortex_probe1() had fully initialised the
device and the data structures. The probe takes tens of milliseconds.
The only thing which prevents this race is the fact that sys_init_module()
and sys_ioctl() both do lock_kernel(). If xxx_probe() drops the BKL,
ifconfig gets in there and fails. Usually, ifconfig finds the driver
has a null ->open() method, so the interface open "succeeds" but the
hardware wasn't opened. A subsequent ->close() will probably crash
the machine.
That is what dev_probe_lock() is doing today. It blocks
ifconfig while ->probe() is in progress. Drivers which
do not use alloc_etherdev() and which can drop the BKL
in probe may fail to work with /sbin/hotplug initialisation
if dev_probe_lock() is removed. At present that seems to
include acenic, eepro100, pcnet32 and everyone's 3c59x
except mine :)
-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/