diff options
author | Bruno Prémont <bonbons@linux-vserver.org> | 2009-04-29 16:45:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-01 18:24:18 -0400 |
commit | 2382b15bcc39228572ccf1d9a1185dcabb84c833 (patch) | |
tree | f24ff62a60da71984288f81ddbbc20476d18d063 /drivers/net/netconsole.c | |
parent | acda074390270ca9e28f2a9729f7b835e2ad6da4 (diff) |
netconsole: take care of NETDEV_UNREGISTER event
When netconsole is loaded and a network interface fades away (e.g. on
rmmod $interface_driver_module) the rmmod remains stuck and some locks
are taken that prevent any additional module loading/unloading as well
as interface up/down changes.
In addition kernel logs (and console) get flooded at 10s interval with
[ 122.464065] unregister_netdevice: waiting for eth0 to become free. Usage count = 1
[ 132.704059] unregister_netdevice: waiting for eth0 to become free. Usage count = 1
This patch lets netconsole take NETDEV_UNREGISTER event into account
and release the affected interface if it was in use.
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r-- | drivers/net/netconsole.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index eceadf787a6..bf4af5248cb 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
664 | struct netconsole_target *nt; | 664 | struct netconsole_target *nt; |
665 | struct net_device *dev = ptr; | 665 | struct net_device *dev = ptr; |
666 | 666 | ||
667 | if (!(event == NETDEV_CHANGENAME)) | 667 | if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER)) |
668 | goto done; | 668 | goto done; |
669 | 669 | ||
670 | spin_lock_irqsave(&target_list_lock, flags); | 670 | spin_lock_irqsave(&target_list_lock, flags); |
@@ -675,6 +675,15 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
675 | case NETDEV_CHANGENAME: | 675 | case NETDEV_CHANGENAME: |
676 | strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); | 676 | strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); |
677 | break; | 677 | break; |
678 | case NETDEV_UNREGISTER: | ||
679 | if (!nt->enabled) | ||
680 | break; | ||
681 | netpoll_cleanup(&nt->np); | ||
682 | nt->enabled = 0; | ||
683 | printk(KERN_INFO "netconsole: network logging stopped" | ||
684 | ", interface %s unregistered\n", | ||
685 | dev->name); | ||
686 | break; | ||
678 | } | 687 | } |
679 | } | 688 | } |
680 | netconsole_target_put(nt); | 689 | netconsole_target_put(nt); |