lkml.org 
[lkml]   [2000]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: hotplug mopup
"Albert D. Cahalan" wrote:
>
> Marcus Meissner writes:
>
> >> - On the unregister/removal path, the netdevice layer ensures that
> >> the interface is removed from the kernel namespace prior to launching
> >> `/sbin/hotplug net unregister eth0'.
> >>
> >> This means that when handling netdevice unregistration
> >> /sbin/hotplug cannot and must not attempt to do anything with eth0!
> >> Generally it'll fail to find an interface with this name. If it does
> >> find eth0, it'll be the wrong one due to a race.
> >
> > I always thought I should have to do "/sbin/ifdown eth0" here.
> > (Just as I do /sbin/ifup eth0 on register.)
>
> Yes, definitely. Otherwise, how can one replace the eth0 hardware
> without messing up the network settings? This is supposed to be
> hot plug and all... to me that means I can rip out one network
> card and pop in another without breaking my ssh connections.

Let's see...

You pull the card (let's suppose it's Cardbus). That causes an
interrupt which eventually gets fed to the PCI layer's
pci_remove_device().

The PCI layer calls the netdevice's pci_driver.remove() method.

Typically, xxx_remove() calls unregister_netdevice().

unregister_netdevice() downs the interface, then removes the
netdevice from the kernel namespace and then runs
'/sbin/hotplug net unregister eth0' asynchronously.

When we return from unregister_netdevice() we can guarantee
that the driver's module refcount is zero if this was the
last matching device.

We then wind all the way back to the PCI layer, whizzing gaily
back through the driver whose module refcount is now zero. Sigh.

The PCI layer runs '/sbin/hotplug pci remove' asynchronously. The
driver can be unloaded.

So where in all of this can you read the interface's network
settings? Nowhere, I'm afraid. They're released in
unregister_netdevice().

Isn't this a userspace tool problem?

-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.033 / U:1.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site