* [V3 Patch 1/3] netpoll: disable netpoll when enslave a device
@ 2011-05-20 7:39 Amerigo Wang
2011-05-20 7:39 ` [Patch 2/3] bridge: call NETDEV_JOIN notifiers when add a slave Amerigo Wang
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Amerigo Wang @ 2011-05-20 7:39 UTC (permalink / raw)
To: netdev; +Cc: WANG Cong, Neil Horman
V3: rename NETDEV_ENSLAVE to NETDEV_JOIN
Currently we do nothing when we enslave a net device which is running netconsole.
Neil pointed out that we may get weird results in such case, so let's disable
netpoll on the device being enslaved. I think it is too harsh to prevent
the device being ensalved if it is running netconsole.
By the way, this patch also removes the NETDEV_GOING_DOWN from netconsole
netdev notifier, because netpoll will check if the device is running or not
and we don't handle NETDEV_PRE_UP neither.
This patch is based on net-next-2.6.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Neil Horman <nhorman@redhat.com>
---
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 088fd84..f4960f5 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1640,6 +1640,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
}
}
+ call_netdevice_notifiers(NETDEV_JOIN, slave_dev);
+
/* If this is the first slave, then we need to set the master's hardware
* address to be the same as the slave's. */
if (is_zero_ether_addr(bond->dev->dev_addr))
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index a83e101..4190786 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -621,11 +621,10 @@ static int netconsole_netdev_event(struct notifier_block *this,
bool stopped = false;
if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER ||
- event == NETDEV_BONDING_DESLAVE || event == NETDEV_GOING_DOWN))
+ event == NETDEV_BONDING_DESLAVE || event == NETDEV_JOIN))
goto done;
spin_lock_irqsave(&target_list_lock, flags);
-restart:
list_for_each_entry(nt, &target_list, list) {
netconsole_target_get(nt);
if (nt->np.dev == dev) {
@@ -633,6 +632,8 @@ restart:
case NETDEV_CHANGENAME:
strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
break;
+ case NETDEV_BONDING_DESLAVE:
+ case NETDEV_JOIN:
case NETDEV_UNREGISTER:
/*
* rtnl_lock already held
@@ -647,11 +648,7 @@ restart:
dev_put(nt->np.dev);
nt->np.dev = NULL;
netconsole_target_put(nt);
- goto restart;
}
- /* Fall through */
- case NETDEV_GOING_DOWN:
- case NETDEV_BONDING_DESLAVE:
nt->enabled = 0;
stopped = true;
break;
@@ -660,10 +657,21 @@ restart:
netconsole_target_put(nt);
}
spin_unlock_irqrestore(&target_list_lock, flags);
- if (stopped && (event == NETDEV_UNREGISTER || event == NETDEV_BONDING_DESLAVE))
+ if (stopped) {
printk(KERN_INFO "netconsole: network logging stopped on "
- "interface %s as it %s\n", dev->name,
- event == NETDEV_UNREGISTER ? "unregistered" : "released slaves");
+ "interface %s as it ", dev->name);
+ switch (event) {
+ case NETDEV_UNREGISTER:
+ printk(KERN_CONT "unregistered\n");
+ break;
+ case NETDEV_BONDING_DESLAVE:
+ printk(KERN_CONT "released slaves\n");
+ break;
+ case NETDEV_JOIN:
+ printk(KERN_CONT "is joining a master device\n");
+ break;
+ }
+ }
done:
return NOTIFY_DONE;
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 621dfa1..a577762 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -211,6 +211,7 @@ static inline int notifier_to_errno(int ret)
#define NETDEV_UNREGISTER_BATCH 0x0011
#define NETDEV_BONDING_DESLAVE 0x0012
#define NETDEV_NOTIFY_PEERS 0x0013
+#define NETDEV_JOIN 0x0014
#define SYS_DOWN 0x0001 /* Notify of system down */
#define SYS_RESTART SYS_DOWN
--
1.7.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Patch 2/3] bridge: call NETDEV_JOIN notifiers when add a slave
2011-05-20 7:39 [V3 Patch 1/3] netpoll: disable netpoll when enslave a device Amerigo Wang
@ 2011-05-20 7:39 ` Amerigo Wang
2011-05-23 1:03 ` David Miller
2011-05-20 7:39 ` [Patch 3/3] net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE Amerigo Wang
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Amerigo Wang @ 2011-05-20 7:39 UTC (permalink / raw)
To: netdev; +Cc: WANG Cong, Neil Horman
In the previous patch I added NETDEV_JOIN, now
we can notify netconsole when adding a device to a bridge too.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Neil Horman <nhorman@redhat.com>
---
net/bridge/br_if.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 5dbdfdf..d5147dd 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -338,6 +338,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
if (IS_ERR(p))
return PTR_ERR(p);
+ call_netdevice_notifiers(NETDEV_JOIN, dev);
+
err = dev_set_promiscuity(dev, 1);
if (err)
goto put_back;
--
1.7.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Patch 3/3] net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE
2011-05-20 7:39 [V3 Patch 1/3] netpoll: disable netpoll when enslave a device Amerigo Wang
2011-05-20 7:39 ` [Patch 2/3] bridge: call NETDEV_JOIN notifiers when add a slave Amerigo Wang
@ 2011-05-20 7:39 ` Amerigo Wang
2011-05-23 1:03 ` David Miller
2011-05-23 15:17 ` Andy Gospodarek
2011-05-20 9:06 ` [PATCH 4/3] rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event Amerigo Wang
2011-05-23 1:03 ` [V3 Patch 1/3] netpoll: disable netpoll when enslave a device David Miller
3 siblings, 2 replies; 9+ messages in thread
From: Amerigo Wang @ 2011-05-20 7:39 UTC (permalink / raw)
To: netdev; +Cc: WANG Cong, Andy Gospodarek, Neil Horman
s/NETDEV_BONDING_DESLAVE/NETDEV_RELEASE/ as Andy suggested.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: Neil Horman <nhorman@redhat.com>
---
drivers/net/bonding/bond_main.c | 2 +-
drivers/net/netconsole.c | 6 +++---
include/linux/notifier.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f4960f5..6dc4284 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1974,7 +1974,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
}
block_netpoll_tx();
- netdev_bonding_change(bond_dev, NETDEV_BONDING_DESLAVE);
+ netdev_bonding_change(bond_dev, NETDEV_RELEASE);
write_lock_bh(&bond->lock);
slave = bond_get_slave_by_dev(bond, slave_dev);
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 4190786..dfc8272 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -621,7 +621,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
bool stopped = false;
if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER ||
- event == NETDEV_BONDING_DESLAVE || event == NETDEV_JOIN))
+ event == NETDEV_RELEASE || event == NETDEV_JOIN))
goto done;
spin_lock_irqsave(&target_list_lock, flags);
@@ -632,7 +632,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
case NETDEV_CHANGENAME:
strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
break;
- case NETDEV_BONDING_DESLAVE:
+ case NETDEV_RELEASE:
case NETDEV_JOIN:
case NETDEV_UNREGISTER:
/*
@@ -664,7 +664,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
case NETDEV_UNREGISTER:
printk(KERN_CONT "unregistered\n");
break;
- case NETDEV_BONDING_DESLAVE:
+ case NETDEV_RELEASE:
printk(KERN_CONT "released slaves\n");
break;
case NETDEV_JOIN:
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index a577762..c0688b0 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -209,7 +209,7 @@ static inline int notifier_to_errno(int ret)
#define NETDEV_POST_TYPE_CHANGE 0x000F
#define NETDEV_POST_INIT 0x0010
#define NETDEV_UNREGISTER_BATCH 0x0011
-#define NETDEV_BONDING_DESLAVE 0x0012
+#define NETDEV_RELEASE 0x0012
#define NETDEV_NOTIFY_PEERS 0x0013
#define NETDEV_JOIN 0x0014
--
1.7.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/3] rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event
2011-05-20 7:39 [V3 Patch 1/3] netpoll: disable netpoll when enslave a device Amerigo Wang
2011-05-20 7:39 ` [Patch 2/3] bridge: call NETDEV_JOIN notifiers when add a slave Amerigo Wang
2011-05-20 7:39 ` [Patch 3/3] net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE Amerigo Wang
@ 2011-05-20 9:06 ` Amerigo Wang
2011-05-23 1:03 ` David Miller
2011-05-23 1:03 ` [V3 Patch 1/3] netpoll: disable netpoll when enslave a device David Miller
3 siblings, 1 reply; 9+ messages in thread
From: Amerigo Wang @ 2011-05-20 9:06 UTC (permalink / raw)
To: netdev; +Cc: WANG Cong
These two events are not expected to be caught by userspace.
Signed-off-by: WANG Cong <amwang@redhat.com>
---
net/core/rtnetlink.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d2ba259..d1644e3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1956,6 +1956,8 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
case NETDEV_GOING_DOWN:
case NETDEV_UNREGISTER:
case NETDEV_UNREGISTER_BATCH:
+ case NETDEV_RELEASE:
+ case NETDEV_JOIN:
break;
default:
rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
--
1.7.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [V3 Patch 1/3] netpoll: disable netpoll when enslave a device
2011-05-20 7:39 [V3 Patch 1/3] netpoll: disable netpoll when enslave a device Amerigo Wang
` (2 preceding siblings ...)
2011-05-20 9:06 ` [PATCH 4/3] rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event Amerigo Wang
@ 2011-05-23 1:03 ` David Miller
3 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2011-05-23 1:03 UTC (permalink / raw)
To: amwang; +Cc: netdev, nhorman
From: Amerigo Wang <amwang@redhat.com>
Date: Fri, 20 May 2011 15:39:10 +0800
> V3: rename NETDEV_ENSLAVE to NETDEV_JOIN
>
> Currently we do nothing when we enslave a net device which is running netconsole.
> Neil pointed out that we may get weird results in such case, so let's disable
> netpoll on the device being enslaved. I think it is too harsh to prevent
> the device being ensalved if it is running netconsole.
>
> By the way, this patch also removes the NETDEV_GOING_DOWN from netconsole
> netdev notifier, because netpoll will check if the device is running or not
> and we don't handle NETDEV_PRE_UP neither.
>
> This patch is based on net-next-2.6.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Neil Horman <nhorman@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch 2/3] bridge: call NETDEV_JOIN notifiers when add a slave
2011-05-20 7:39 ` [Patch 2/3] bridge: call NETDEV_JOIN notifiers when add a slave Amerigo Wang
@ 2011-05-23 1:03 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2011-05-23 1:03 UTC (permalink / raw)
To: amwang; +Cc: netdev, nhorman
From: Amerigo Wang <amwang@redhat.com>
Date: Fri, 20 May 2011 15:39:11 +0800
> In the previous patch I added NETDEV_JOIN, now
> we can notify netconsole when adding a device to a bridge too.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Neil Horman <nhorman@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch 3/3] net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE
2011-05-20 7:39 ` [Patch 3/3] net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE Amerigo Wang
@ 2011-05-23 1:03 ` David Miller
2011-05-23 15:17 ` Andy Gospodarek
1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2011-05-23 1:03 UTC (permalink / raw)
To: amwang; +Cc: netdev, andy, nhorman
From: Amerigo Wang <amwang@redhat.com>
Date: Fri, 20 May 2011 15:39:12 +0800
> s/NETDEV_BONDING_DESLAVE/NETDEV_RELEASE/ as Andy suggested.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Andy Gospodarek <andy@greyhouse.net>
> Cc: Neil Horman <nhorman@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/3] rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event
2011-05-20 9:06 ` [PATCH 4/3] rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event Amerigo Wang
@ 2011-05-23 1:03 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2011-05-23 1:03 UTC (permalink / raw)
To: amwang; +Cc: netdev
From: Amerigo Wang <amwang@redhat.com>
Date: Fri, 20 May 2011 17:06:32 +0800
> These two events are not expected to be caught by userspace.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch 3/3] net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE
2011-05-20 7:39 ` [Patch 3/3] net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE Amerigo Wang
2011-05-23 1:03 ` David Miller
@ 2011-05-23 15:17 ` Andy Gospodarek
1 sibling, 0 replies; 9+ messages in thread
From: Andy Gospodarek @ 2011-05-23 15:17 UTC (permalink / raw)
To: Amerigo Wang; +Cc: netdev, Andy Gospodarek, Neil Horman
On Fri, May 20, 2011 at 03:39:12PM +0800, Amerigo Wang wrote:
> s/NETDEV_BONDING_DESLAVE/NETDEV_RELEASE/ as Andy suggested.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Andy Gospodarek <andy@greyhouse.net>
> Cc: Neil Horman <nhorman@redhat.com>
>
I know Dave already applied it (so I won't bother with a signed-off-by
line), but thanks for doing this.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-05-23 15:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20 7:39 [V3 Patch 1/3] netpoll: disable netpoll when enslave a device Amerigo Wang
2011-05-20 7:39 ` [Patch 2/3] bridge: call NETDEV_JOIN notifiers when add a slave Amerigo Wang
2011-05-23 1:03 ` David Miller
2011-05-20 7:39 ` [Patch 3/3] net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE Amerigo Wang
2011-05-23 1:03 ` David Miller
2011-05-23 15:17 ` Andy Gospodarek
2011-05-20 9:06 ` [PATCH 4/3] rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event Amerigo Wang
2011-05-23 1:03 ` David Miller
2011-05-23 1:03 ` [V3 Patch 1/3] netpoll: disable netpoll when enslave a device David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.