* [net-next-2.6 PATCH 1/3] net: rename notifier defines for netdev type change
2010-03-10 20:28 [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 Jiri Pirko
@ 2010-03-10 20:28 ` Jiri Pirko
2010-03-10 20:29 ` [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type Jiri Pirko
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2010-03-10 20:28 UTC (permalink / raw)
To: netdev; +Cc: fubar, bonding-devel, davem, shemminger, kaber
Since generally there could be more netdevices changing type other than bonding,
making this event type name "bonding-unrelated"
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
drivers/net/bonding/bond_main.c | 6 ++++--
include/linux/notifier.h | 4 ++--
net/ipv4/devinet.c | 4 ++--
net/ipv6/addrconf.c | 16 ++++++++--------
4 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 430c022..7eeb187 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1480,14 +1480,16 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
bond_dev->name,
bond_dev->type, slave_dev->type);
- netdev_bonding_change(bond_dev, NETDEV_BONDING_OLDTYPE);
+ netdev_bonding_change(bond_dev,
+ NETDEV_PRE_TYPE_CHANGE);
if (slave_dev->type != ARPHRD_ETHER)
bond_setup_by_slave(bond_dev, slave_dev);
else
ether_setup(bond_dev);
- netdev_bonding_change(bond_dev, NETDEV_BONDING_NEWTYPE);
+ netdev_bonding_change(bond_dev,
+ NETDEV_POST_TYPE_CHANGE);
}
} else if (bond_dev->type != slave_dev->type) {
pr_err("%s ether type (%d) is different from other slaves (%d), can not enslave it.\n",
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index fee6c2f..f3635fc 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -199,8 +199,8 @@ static inline int notifier_to_errno(int ret)
#define NETDEV_FEAT_CHANGE 0x000B
#define NETDEV_BONDING_FAILOVER 0x000C
#define NETDEV_PRE_UP 0x000D
-#define NETDEV_BONDING_OLDTYPE 0x000E
-#define NETDEV_BONDING_NEWTYPE 0x000F
+#define NETDEV_PRE_TYPE_CHANGE 0x000E
+#define NETDEV_POST_TYPE_CHANGE 0x000F
#define NETDEV_POST_INIT 0x0010
#define NETDEV_UNREGISTER_BATCH 0x0011
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 51ca946..c75320e 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1095,10 +1095,10 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
case NETDEV_DOWN:
ip_mc_down(in_dev);
break;
- case NETDEV_BONDING_OLDTYPE:
+ case NETDEV_PRE_TYPE_CHANGE:
ip_mc_unmap(in_dev);
break;
- case NETDEV_BONDING_NEWTYPE:
+ case NETDEV_POST_TYPE_CHANGE:
ip_mc_remap(in_dev);
break;
case NETDEV_CHANGEMTU:
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 88fd8c5..bf5349b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -137,8 +137,8 @@ static DEFINE_SPINLOCK(addrconf_verify_lock);
static void addrconf_join_anycast(struct inet6_ifaddr *ifp);
static void addrconf_leave_anycast(struct inet6_ifaddr *ifp);
-static void addrconf_bonding_change(struct net_device *dev,
- unsigned long event);
+static void addrconf_type_change(struct net_device *dev,
+ unsigned long event);
static int addrconf_ifdown(struct net_device *dev, int how);
static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags);
@@ -2582,9 +2582,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
return notifier_from_errno(err);
}
break;
- case NETDEV_BONDING_OLDTYPE:
- case NETDEV_BONDING_NEWTYPE:
- addrconf_bonding_change(dev, event);
+ case NETDEV_PRE_TYPE_CHANGE:
+ case NETDEV_POST_TYPE_CHANGE:
+ addrconf_type_change(dev, event);
break;
}
@@ -2599,16 +2599,16 @@ static struct notifier_block ipv6_dev_notf = {
.priority = 0
};
-static void addrconf_bonding_change(struct net_device *dev, unsigned long event)
+static void addrconf_type_change(struct net_device *dev, unsigned long event)
{
struct inet6_dev *idev;
ASSERT_RTNL();
idev = __in6_dev_get(dev);
- if (event == NETDEV_BONDING_NEWTYPE)
+ if (event == NETDEV_POST_TYPE_CHANGE)
ipv6_mc_remap(idev);
- else if (event == NETDEV_BONDING_OLDTYPE)
+ else if (event == NETDEV_PRE_TYPE_CHANGE)
ipv6_mc_unmap(idev);
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type
2010-03-10 20:28 [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 Jiri Pirko
2010-03-10 20:28 ` [net-next-2.6 PATCH 1/3] net: rename notifier defines for netdev type change Jiri Pirko
@ 2010-03-10 20:29 ` Jiri Pirko
2010-03-10 22:47 ` [Bonding-devel] " Stephen Hemminger
2010-03-10 20:30 ` [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type Jiri Pirko
2010-03-19 3:05 ` [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 David Miller
3 siblings, 1 reply; 10+ messages in thread
From: Jiri Pirko @ 2010-03-10 20:29 UTC (permalink / raw)
To: netdev; +Cc: fubar, bonding-devel, davem, shemminger, kaber
This patch adds the possibility to refuse the bonding type change for other
subsystems (such as for example bridge, vlan, etc.)
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
drivers/net/bonding/bond_main.c | 11 +++++++++--
include/linux/netdevice.h | 2 +-
net/core/dev.c | 4 ++--
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7eeb187..cbe9e35 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1480,8 +1480,15 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
bond_dev->name,
bond_dev->type, slave_dev->type);
- netdev_bonding_change(bond_dev,
- NETDEV_PRE_TYPE_CHANGE);
+ res = netdev_bonding_change(bond_dev,
+ NETDEV_PRE_TYPE_CHANGE);
+ res = notifier_to_errno(res);
+ if (res) {
+ pr_err("%s: refused to change device type\n",
+ bond_dev->name);
+ res = -EBUSY;
+ goto err_undo_flags;
+ }
if (slave_dev->type != ARPHRD_ETHER)
bond_setup_by_slave(bond_dev, slave_dev);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c79a88b..8cf1d50 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1975,7 +1975,7 @@ extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct
extern int dev_set_promiscuity(struct net_device *dev, int inc);
extern int dev_set_allmulti(struct net_device *dev, int inc);
extern void netdev_state_change(struct net_device *dev);
-extern void netdev_bonding_change(struct net_device *dev,
+extern int netdev_bonding_change(struct net_device *dev,
unsigned long event);
extern void netdev_features_change(struct net_device *dev);
/* Load a device via the kmod */
diff --git a/net/core/dev.c b/net/core/dev.c
index bcc490c..5de4a15 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1084,9 +1084,9 @@ void netdev_state_change(struct net_device *dev)
}
EXPORT_SYMBOL(netdev_state_change);
-void netdev_bonding_change(struct net_device *dev, unsigned long event)
+int netdev_bonding_change(struct net_device *dev, unsigned long event)
{
- call_netdevice_notifiers(event, dev);
+ return call_netdevice_notifiers(event, dev);
}
EXPORT_SYMBOL(netdev_bonding_change);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Bonding-devel] [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type
2010-03-10 20:29 ` [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type Jiri Pirko
@ 2010-03-10 22:47 ` Stephen Hemminger
2010-03-11 7:59 ` Jiri Pirko
0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2010-03-10 22:47 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, kaber, fubar, bonding-devel, davem
On Wed, 10 Mar 2010 21:29:35 +0100
Jiri Pirko <jpirko@redhat.com> wrote:
> diff --git a/net/core/dev.c b/net/core/dev.c
> index bcc490c..5de4a15 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1084,9 +1084,9 @@ void netdev_state_change(struct net_device *dev)
> }
> EXPORT_SYMBOL(netdev_state_change);
>
> -void netdev_bonding_change(struct net_device *dev, unsigned long event)
> +int netdev_bonding_change(struct net_device *dev, unsigned long event)
> {
> - call_netdevice_notifiers(event, dev);
> + return call_netdevice_notifiers(event, dev);
> }
> EXPORT_SYMBOL(netdev_bonding_change);
>
I don't think all this pre-post stuff needed.
Since this is general (not just bonding) how about
int netdev_change_type(struct net_device *dev, int newtype)
{
int ret, oldtype;
if (dev->flags & IFF_UP)
return -EBUSY;
oldtype = dev->type;
dev->type = newtype;
ret = call_netdevice_notifier(NETDEV_CHANGETYPE, dev);
ret = notifier_to_errno(ret);
if (ret)
dev->type = oldtype;
return ret;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bonding-devel] [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type
2010-03-10 22:47 ` [Bonding-devel] " Stephen Hemminger
@ 2010-03-11 7:59 ` Jiri Pirko
2010-03-11 9:53 ` Jiri Pirko
0 siblings, 1 reply; 10+ messages in thread
From: Jiri Pirko @ 2010-03-11 7:59 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, kaber, fubar, bonding-devel, davem
Wed, Mar 10, 2010 at 11:47:10PM CET, shemminger@linux-foundation.org wrote:
>On Wed, 10 Mar 2010 21:29:35 +0100
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index bcc490c..5de4a15 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -1084,9 +1084,9 @@ void netdev_state_change(struct net_device *dev)
>> }
>> EXPORT_SYMBOL(netdev_state_change);
>>
>> -void netdev_bonding_change(struct net_device *dev, unsigned long event)
>> +int netdev_bonding_change(struct net_device *dev, unsigned long event)
>> {
>> - call_netdevice_notifiers(event, dev);
>> + return call_netdevice_notifiers(event, dev);
>> }
>> EXPORT_SYMBOL(netdev_bonding_change);
>>
>
>I don't think all this pre-post stuff needed.
>Since this is general (not just bonding) how about
Well actually I reused NETDEV_BONDING_OLDTYPE. This and NETDEV_BONDING_NEWTYPE
is used in inetdev_event() and addrconf_notify(). These functions apparently
need to be notified before and after the change.
>
>int netdev_change_type(struct net_device *dev, int newtype)
>{
> int ret, oldtype;
>
> if (dev->flags & IFF_UP)
> return -EBUSY;
>
> oldtype = dev->type;
> dev->type = newtype;
> ret = call_netdevice_notifier(NETDEV_CHANGETYPE, dev);
> ret = notifier_to_errno(ret);
> if (ret)
> dev->type = oldtype;
>
> return ret;
>}
I see you point here, but that would be another notifier event. Do you suggest
to have 3 of them finally? NETDEV_BONDING_OLDTYPE, NETDEV_BONDING_NEWTYPE and
NETDEV_CHANGETYPE. Looks a bit redundant to me...
Thanks.
Jirka
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bonding-devel] [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type
2010-03-11 7:59 ` Jiri Pirko
@ 2010-03-11 9:53 ` Jiri Pirko
0 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2010-03-11 9:53 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, kaber, fubar, bonding-devel, davem
Thu, Mar 11, 2010 at 08:59:09AM CET, jpirko@redhat.com wrote:
>Wed, Mar 10, 2010 at 11:47:10PM CET, shemminger@linux-foundation.org wrote:
>>On Wed, 10 Mar 2010 21:29:35 +0100
>>Jiri Pirko <jpirko@redhat.com> wrote:
>>
>>> diff --git a/net/core/dev.c b/net/core/dev.c
>>> index bcc490c..5de4a15 100644
>>> --- a/net/core/dev.c
>>> +++ b/net/core/dev.c
>>> @@ -1084,9 +1084,9 @@ void netdev_state_change(struct net_device *dev)
>>> }
>>> EXPORT_SYMBOL(netdev_state_change);
>>>
>>> -void netdev_bonding_change(struct net_device *dev, unsigned long event)
>>> +int netdev_bonding_change(struct net_device *dev, unsigned long event)
>>> {
>>> - call_netdevice_notifiers(event, dev);
>>> + return call_netdevice_notifiers(event, dev);
>>> }
>>> EXPORT_SYMBOL(netdev_bonding_change);
>>>
>>
>>I don't think all this pre-post stuff needed.
>>Since this is general (not just bonding) how about
>
>Well actually I reused NETDEV_BONDING_OLDTYPE. This and NETDEV_BONDING_NEWTYPE
>is used in inetdev_event() and addrconf_notify(). These functions apparently
>need to be notified before and after the change.
>
>>
>>int netdev_change_type(struct net_device *dev, int newtype)
>>{
>> int ret, oldtype;
>>
>> if (dev->flags & IFF_UP)
>> return -EBUSY;
>>
>> oldtype = dev->type;
>> dev->type = newtype;
Also, the type change is not only about dev->type. See for example
ether_setup(). This function and it's puprose might be misleading...
>> ret = call_netdevice_notifier(NETDEV_CHANGETYPE, dev);
>> ret = notifier_to_errno(ret);
>> if (ret)
>> dev->type = oldtype;
>>
>> return ret;
>>}
>
>I see you point here, but that would be another notifier event. Do you suggest
>to have 3 of them finally? NETDEV_BONDING_OLDTYPE, NETDEV_BONDING_NEWTYPE and
>NETDEV_CHANGETYPE. Looks a bit redundant to me...
>
>Thanks.
>
>Jirka
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type
2010-03-10 20:28 [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 Jiri Pirko
2010-03-10 20:28 ` [net-next-2.6 PATCH 1/3] net: rename notifier defines for netdev type change Jiri Pirko
2010-03-10 20:29 ` [net-next-2.6 PATCH 2/3] bonding: check return value of nofitier when changing type Jiri Pirko
@ 2010-03-10 20:30 ` Jiri Pirko
2010-03-10 21:04 ` Jay Vosburgh
2010-03-19 3:05 ` [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 David Miller
3 siblings, 1 reply; 10+ messages in thread
From: Jiri Pirko @ 2010-03-10 20:30 UTC (permalink / raw)
To: netdev; +Cc: fubar, bonding-devel, davem, shemminger, kaber
It's not desired for underlaying devices to change type. At the time, there is
for example possible to have bond with changed type from Ethernet to Infiniband
as a port of a bridge. This patch fixes this.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
drivers/net/macvlan.c | 3 +++
net/8021q/vlan.c | 4 ++++
net/bridge/br_notify.c | 4 ++++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 40faa36..445e73c 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -748,6 +748,9 @@ static int macvlan_device_event(struct notifier_block *unused,
list_for_each_entry_safe(vlan, next, &port->vlans, list)
vlan->dev->rtnl_link_ops->dellink(vlan->dev, NULL);
break;
+ case NETDEV_PRE_TYPE_CHANGE:
+ /* Forbid underlaying device to change its type. */
+ return NOTIFY_BAD;
}
return NOTIFY_DONE;
}
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 4535122..c39a5f4 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -530,6 +530,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
}
unregister_netdevice_many(&list);
break;
+
+ case NETDEV_PRE_TYPE_CHANGE:
+ /* Forbid underlaying device to change its type. */
+ return NOTIFY_BAD;
}
out:
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index 763a3ec..1413b72 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -82,6 +82,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
case NETDEV_UNREGISTER:
br_del_if(br, dev);
break;
+
+ case NETDEV_PRE_TYPE_CHANGE:
+ /* Forbid underlaying device to change its type. */
+ return NOTIFY_BAD;
}
/* Events that may cause spanning tree to refresh */
--
1.6.6.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type
2010-03-10 20:30 ` [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type Jiri Pirko
@ 2010-03-10 21:04 ` Jay Vosburgh
2010-03-10 21:17 ` Jiri Pirko
0 siblings, 1 reply; 10+ messages in thread
From: Jay Vosburgh @ 2010-03-10 21:04 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, bonding-devel, davem, shemminger, kaber
Jiri Pirko <jpirko@redhat.com> wrote:
>It's not desired for underlaying devices to change type. At the time, there is
>for example possible to have bond with changed type from Ethernet to Infiniband
>as a port of a bridge. This patch fixes this.
Do the current initscripts / sysconfig packages do things such
that this restriction won't break things? I.e., do those packages have
a dependency on being able to change the type after setting up, e.g., a
VLAN over bonding on Infiniband?
This isn't to suggest that this change should be rejected if the
above is true; rather, I'm curious as to how this came up as a problem,
and whether initscripts / sysconfig require concurrent changes.
In any event, it all seems reasonable to me, so, at least for
the bonding bits:
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
-J
>Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>---
> drivers/net/macvlan.c | 3 +++
> net/8021q/vlan.c | 4 ++++
> net/bridge/br_notify.c | 4 ++++
> 3 files changed, 11 insertions(+), 0 deletions(-)
>
>diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
>index 40faa36..445e73c 100644
>--- a/drivers/net/macvlan.c
>+++ b/drivers/net/macvlan.c
>@@ -748,6 +748,9 @@ static int macvlan_device_event(struct notifier_block *unused,
> list_for_each_entry_safe(vlan, next, &port->vlans, list)
> vlan->dev->rtnl_link_ops->dellink(vlan->dev, NULL);
> break;
>+ case NETDEV_PRE_TYPE_CHANGE:
>+ /* Forbid underlaying device to change its type. */
>+ return NOTIFY_BAD;
> }
> return NOTIFY_DONE;
> }
>diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
>index 4535122..c39a5f4 100644
>--- a/net/8021q/vlan.c
>+++ b/net/8021q/vlan.c
>@@ -530,6 +530,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
> }
> unregister_netdevice_many(&list);
> break;
>+
>+ case NETDEV_PRE_TYPE_CHANGE:
>+ /* Forbid underlaying device to change its type. */
>+ return NOTIFY_BAD;
> }
>
> out:
>diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
>index 763a3ec..1413b72 100644
>--- a/net/bridge/br_notify.c
>+++ b/net/bridge/br_notify.c
>@@ -82,6 +82,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
> case NETDEV_UNREGISTER:
> br_del_if(br, dev);
> break;
>+
>+ case NETDEV_PRE_TYPE_CHANGE:
>+ /* Forbid underlaying device to change its type. */
>+ return NOTIFY_BAD;
> }
>
> /* Events that may cause spanning tree to refresh */
>--
>1.6.6.1
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type
2010-03-10 21:04 ` Jay Vosburgh
@ 2010-03-10 21:17 ` Jiri Pirko
0 siblings, 0 replies; 10+ messages in thread
From: Jiri Pirko @ 2010-03-10 21:17 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: netdev, bonding-devel, davem, shemminger, kaber
Wed, Mar 10, 2010 at 10:04:10PM CET, fubar@us.ibm.com wrote:
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>>It's not desired for underlaying devices to change type. At the time, there is
>>for example possible to have bond with changed type from Ethernet to Infiniband
>>as a port of a bridge. This patch fixes this.
>
> Do the current initscripts / sysconfig packages do things such
>that this restriction won't break things? I.e., do those packages have
>a dependency on being able to change the type after setting up, e.g., a
>VLAN over bonding on Infiniband?
>
> This isn't to suggest that this change should be rejected if the
>above is true; rather, I'm curious as to how this came up as a problem,
>and whether initscripts / sysconfig require concurrent changes.
I'm not aware initscripts / sysconfig require type change. In fanc this
wouldn't make sense. This popped up when I was converting mc_lists, I thought
if this is possible, tried with infiniband and it was. Therefore I decided
to fix this.
Jirka
>
> In any event, it all seems reasonable to me, so, at least for
>the bonding bits:
>
>Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
>
> -J
>
>
>>Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>>---
>> drivers/net/macvlan.c | 3 +++
>> net/8021q/vlan.c | 4 ++++
>> net/bridge/br_notify.c | 4 ++++
>> 3 files changed, 11 insertions(+), 0 deletions(-)
>>
>>diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
>>index 40faa36..445e73c 100644
>>--- a/drivers/net/macvlan.c
>>+++ b/drivers/net/macvlan.c
>>@@ -748,6 +748,9 @@ static int macvlan_device_event(struct notifier_block *unused,
>> list_for_each_entry_safe(vlan, next, &port->vlans, list)
>> vlan->dev->rtnl_link_ops->dellink(vlan->dev, NULL);
>> break;
>>+ case NETDEV_PRE_TYPE_CHANGE:
>>+ /* Forbid underlaying device to change its type. */
>>+ return NOTIFY_BAD;
>> }
>> return NOTIFY_DONE;
>> }
>>diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
>>index 4535122..c39a5f4 100644
>>--- a/net/8021q/vlan.c
>>+++ b/net/8021q/vlan.c
>>@@ -530,6 +530,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
>> }
>> unregister_netdevice_many(&list);
>> break;
>>+
>>+ case NETDEV_PRE_TYPE_CHANGE:
>>+ /* Forbid underlaying device to change its type. */
>>+ return NOTIFY_BAD;
>> }
>>
>> out:
>>diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
>>index 763a3ec..1413b72 100644
>>--- a/net/bridge/br_notify.c
>>+++ b/net/bridge/br_notify.c
>>@@ -82,6 +82,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
>> case NETDEV_UNREGISTER:
>> br_del_if(br, dev);
>> break;
>>+
>>+ case NETDEV_PRE_TYPE_CHANGE:
>>+ /* Forbid underlaying device to change its type. */
>>+ return NOTIFY_BAD;
>> }
>>
>> /* Events that may cause spanning tree to refresh */
>>--
>>1.6.6.1
>>
>>--
>>To unsubscribe from this list: send the line "unsubscribe netdev" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3
2010-03-10 20:28 [net-next-2.6 PATCH 0/3] bonding: refuse to change bond type if it's used V3 Jiri Pirko
` (2 preceding siblings ...)
2010-03-10 20:30 ` [net-next-2.6 PATCH 3/3] net: forbid underlaying devices to change its type Jiri Pirko
@ 2010-03-19 3:05 ` David Miller
3 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2010-03-19 3:05 UTC (permalink / raw)
To: jpirko; +Cc: netdev, fubar, bonding-devel, shemminger, kaber
From: Jiri Pirko <jpirko@redhat.com>
Date: Wed, 10 Mar 2010 21:28:04 +0100
> v2->v3:
> -changed defines name to NETDEV_[PRE/POST]_TYPE_CHANGE
> -added bits for vlan and macvlan
>
> Reworked version of patch/patchset. This time I use netdevice notifier as
> Stephen suggested. Changed the name of the original ones (NETDEV_BONDING_*TYPE)
> to be more general and reused them.
This looks really nice, applied thanks Jiri.
I know a lot of people who would have noticed this and
just said "not my problem" and gone on to work on something
else. Instead you stopped and fixed it, and this is very
much appreciated.
Thanks again!
^ permalink raw reply [flat|nested] 10+ messages in thread