netconsole: take care of NETDEV_UNREGISTER event
Subsystems (3)
PATCH 1/1 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.
---
drivers/net/netconsole.c +10 -1
@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this,struct netconsole_target *nt;struct net_device *dev = ptr; -if (!(event ==NETDEV_CHANGENAME )) +if (!(event ==NETDEV_CHANGENAME || event ==NETDEV_UNREGISTER )) goto done;spin_lock_irqsave (&target_list_lock, flags);
@@ -675,6 +675,15 @@ static int netconsole_netdev_event(struct notifier_block *this,case NETDEV_CHANGENAME :strlcpy (nt->np.dev_name, dev->name,IFNAMSIZ );break ; +case NETDEV_UNREGISTER : +if (!nt->enabled) +break ; +netpoll_cleanup (&nt->np); + nt->enabled =0 ; +printk (KERN_INFO "netconsole: network logging stopped" +", interface %s unregistered\n" , + dev->name); +break ; } }netconsole_target_put (nt);
(fix netdev CC)
The printk line is slightly over 80 though I have no better idea for the line-wrapping while keeping it searchable with grep.
Bruno
Quoted 44 lines · On Wed, 29 April 2009 Bruno Prémont <[email protected]> wrote:
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 = 1This patch lets netconsole take
NETDEV_UNREGISTERevent into account and release the affected interface if it was in use.Signed-off-by Bruno Prémont <[email protected]>---
drivers/net/netconsole.c +1
-1@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this, struct netconsole_target *nt;struct net_device *dev = ptr; -if (!(event ==NETDEV_CHANGENAME )) +if (!(event ==NETDEV_CHANGENAME || event ==NETDEV_UNREGISTER )) goto done;spin_lock_irqsave (&target_list_lock, flags);@@ -675,6 +675,15 @@ static int netconsole_netdev_event(struct
notifier_block*this, caseNETDEV_CHANGENAME:
strlcpy(nt->np.dev_name,dev->name,
IFNAMSIZ); break;drivers/net/netconsole.c +9
-0+case NETDEV_UNREGISTER : +if (!nt->enabled) +break ; +netpoll_cleanup (&nt->np); + nt->enabled =0 ; +printk (KERN_INFO "netconsole: network logging stopped" +", interface %s unregistered\n" , + dev->name); +break ; } }netconsole_target_put (nt);
David Miller
maintainerFrom: Bruno Prémont <[email protected]>
Date: Wed, 29 Apr 2009 22:56:25 +0200
Quoted 1 line
(fix netdev CC)
Please make a fresh submission with the correct netdev address so that your patch is properly tracked at:
http://patchwork.ozlabs.org/project/netdev/list/
Thank you.
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.
---
drivers/net/netconsole.c +10 -1
@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this,struct netconsole_target *nt;struct net_device *dev = ptr; -if (!(event ==NETDEV_CHANGENAME )) +if (!(event ==NETDEV_CHANGENAME || event ==NETDEV_UNREGISTER )) goto done;spin_lock_irqsave (&target_list_lock, flags);
@@ -675,6 +675,15 @@ static int netconsole_netdev_event(struct notifier_block *this,case NETDEV_CHANGENAME :strlcpy (nt->np.dev_name, dev->name,IFNAMSIZ );break ; +case NETDEV_UNREGISTER : +if (!nt->enabled) +break ; +netpoll_cleanup (&nt->np); + nt->enabled =0 ; +printk (KERN_INFO "netconsole: network logging stopped" +", interface %s unregistered\n" , + dev->name); +break ; } }netconsole_target_put (nt);
Matt Mackall
Acked-byQuoted 6 lines · Bruno Prémont
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
Quoted 7 lines
[ 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 = 1This patch lets netconsole take
NETDEV_UNREGISTERevent into account and release the affected interface if it was in use.Signed-off-by Bruno Prémont <[email protected]>
Quoted 35 lines
---
drivers/net/netconsole.c +10
-2@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this,struct netconsole_target *nt;struct net_device *dev = ptr; -if (!(event ==NETDEV_CHANGENAME )) +if (!(event ==NETDEV_CHANGENAME || event ==NETDEV_UNREGISTER )) goto done;spin_lock_irqsave (&target_list_lock, flags);@@ -675,6 +675,15 @@ static int netconsole_netdev_event(struct notifier_block *this,case NETDEV_CHANGENAME :strlcpy (nt->np.dev_name, dev->name,IFNAMSIZ );break ; +case NETDEV_UNREGISTER : +if (!nt->enabled) +break ; +netpoll_cleanup (&nt->np); + nt->enabled =0 ; +printk (KERN_INFO "netconsole: network logging stopped" +", interface %s unregistered\n" , + dev->name); +break ; } }netconsole_target_put (nt); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
http://selenic.com : development and support for Mercurial and Linux
From: Matt Mackall <[email protected]>
Date: Thu, 30 Apr 2009 11:48:35 -0500
Quoted 10 lines · Bruno Prémont
Quoted 9 lines
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
Quoted 6 lines
Quoted 4 lines
This patch lets netconsole take
NETDEV_UNREGISTERevent into account and release the affected interface if it was in use.Signed-off-by Bruno Prémont <[email protected]>Acked-by Matt Mackall <[email protected]>
Applied, thanks everyone.