* [PATCH] netconsole: take care of NETDEV_UNREGISTER event
@ 2009-04-29 20:37 Bruno Prémont
2009-04-29 20:56 ` Bruno Prémont
0 siblings, 1 reply; 6+ messages in thread
From: Bruno Prémont @ 2009-04-29 20:37 UTC (permalink / raw)
To: David Miller; +Cc: linux-netdev, linux-kernel
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>
---
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index eceadf7..bf4af52 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -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);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] netconsole: take care of NETDEV_UNREGISTER event
2009-04-29 20:37 [PATCH] netconsole: take care of NETDEV_UNREGISTER event Bruno Prémont
@ 2009-04-29 20:56 ` Bruno Prémont
2009-04-29 21:44 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Bruno Prémont @ 2009-04-29 20:56 UTC (permalink / raw)
Cc: David Miller, netdev, linux-kernel
(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
On Wed, 29 April 2009 Bruno Prémont <bonbons@linux-vserver.org> 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 = 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>
> ---
> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> index eceadf7..bf4af52 100644
> --- a/drivers/net/netconsole.c
> +++ b/drivers/net/netconsole.c
> @@ -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);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] netconsole: take care of NETDEV_UNREGISTER event
2009-04-29 20:56 ` Bruno Prémont
@ 2009-04-29 21:44 ` David Miller
2009-04-30 6:45 ` [PATCH, resend] " Bruno Prémont
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2009-04-29 21:44 UTC (permalink / raw)
To: bonbons; +Cc: netdev, linux-kernel
From: Bruno Prémont <bonbons@linux-vserver.org>
Date: Wed, 29 Apr 2009 22:56:25 +0200
> (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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH, resend] netconsole: take care of NETDEV_UNREGISTER event
2009-04-29 21:44 ` David Miller
@ 2009-04-30 6:45 ` Bruno Prémont
2009-04-30 16:48 ` Matt Mackall
0 siblings, 1 reply; 6+ messages in thread
From: Bruno Prémont @ 2009-04-30 6:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel
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>
---
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index eceadf7..bf4af52 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -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);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH, resend] netconsole: take care of NETDEV_UNREGISTER event
2009-04-30 6:45 ` [PATCH, resend] " Bruno Prémont
@ 2009-04-30 16:48 ` Matt Mackall
2009-05-01 22:24 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Matt Mackall @ 2009-04-30 16:48 UTC (permalink / raw)
To: Bruno Prémont; +Cc: David Miller, netdev, linux-kernel
On Thu, 2009-04-30 at 08:45 +0200, Bruno Prémont 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 = 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>
> ---
> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> index eceadf7..bf4af52 100644
> --- a/drivers/net/netconsole.c
> +++ b/drivers/net/netconsole.c
> @@ -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 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/
--
http://selenic.com : development and support for Mercurial and Linux
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH, resend] netconsole: take care of NETDEV_UNREGISTER event
2009-04-30 16:48 ` Matt Mackall
@ 2009-05-01 22:24 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-05-01 22:24 UTC (permalink / raw)
To: mpm; +Cc: bonbons, netdev, linux-kernel
From: Matt Mackall <mpm@selenic.com>
Date: Thu, 30 Apr 2009 11:48:35 -0500
> On Thu, 2009-04-30 at 08:45 +0200, Bruno Prémont 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 = 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>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-05-01 22:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-29 20:37 [PATCH] netconsole: take care of NETDEV_UNREGISTER event Bruno Prémont
2009-04-29 20:56 ` Bruno Prémont
2009-04-29 21:44 ` David Miller
2009-04-30 6:45 ` [PATCH, resend] " Bruno Prémont
2009-04-30 16:48 ` Matt Mackall
2009-05-01 22:24 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).