Message ID | 32609.1256947853@death.nxdomain.ibm.com |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
Jay Vosburgh <fubar@us.ibm.com> writes: > No, to both questions. Also, if I back out the 7 bonding > patches, the same insmod / rmmod does not panic. > > I just set it up and did it again. Fresh boot of the system > (which doesn't load bonding); "insmod drivers/net/bonding/bonding.ko; > rmmod bonding" and blammo. > > A little bisect action reveals that the problem first appears > after applying the fifth patch (below). Does a basic insmod / rmmod > cycle work ok for you? I'm specifying no options to bonding. It works here. The only issue I found was that veth wasn't quite working. I am wondering if there was some version of the tree where rtnl_link_unregister is broken and you applied the patches to that. I tested the net-next tree with my patches at the top: There are some other differences like I am running a 64bit kernel but I don't expect that would make a difference in practice. Eric commit 6639104bd826e0b1388c69a6b7564fffc636c8a8 Author: Eric W. Biederman <ebiederm@xmission.com> Date: Thu Oct 29 23:58:54 2009 +0000 bond: Get the rtnl_link_ops support correct - Don't call rtnl_link_unregister if rtnl_link_register fails - Set .priv_size so we aren't stomping on uninitialized memory when we use netdev_priv, on bond devices created with ip link add type bond. Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> -- 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
Eric W. Biederman <ebiederm@xmission.com> wrote: >Jay Vosburgh <fubar@us.ibm.com> writes: > >> No, to both questions. Also, if I back out the 7 bonding >> patches, the same insmod / rmmod does not panic. >> >> I just set it up and did it again. Fresh boot of the system >> (which doesn't load bonding); "insmod drivers/net/bonding/bonding.ko; >> rmmod bonding" and blammo. >> >> A little bisect action reveals that the problem first appears >> after applying the fifth patch (below). Does a basic insmod / rmmod >> cycle work ok for you? I'm specifying no options to bonding. > >It works here. The only issue I found was that veth wasn't quite >working. I am wondering if there was some version of the tree >where rtnl_link_unregister is broken and you applied the patches to that. Must have been, I did a pull of net-next-2.6 and it seems to work ok now. Not sure what it was; I was only a day or so behind. Anyway, it doesn't panic now; I'll give it some further testing next week. -J --- -Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com -- 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
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 7a37ecf..6da2a82 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4612,22 +4612,6 @@ static void bond_uninit(struct net_device *bond_dev) netif_addr_unlock_bh(bond_dev); } -/* Unregister and free all bond devices. - * Caller must hold rtnl_lock. - */ -static void bond_free_all(void) -{ - struct bonding *bond, *nxt; - - list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) { - struct net_device *bond_dev = bond->dev; - - unregister_netdevice(bond_dev); - } - - bond_destroy_proc_dir(); -} - /*------------------------- Module initialization ---------------------------*/ /* @@ -5065,6 +5049,23 @@ static int bond_init(struct net_device *bond_dev) return 0; } +static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) +{ + if (tb[IFLA_ADDRESS]) { + if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) + return -EINVAL; + if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) + return -EADDRNOTAVAIL; + } + return 0; +} + +static struct rtnl_link_ops bond_link_ops __read_mostly = { + .kind = "bond", + .setup = bond_setup, + .validate = bond_validate, +}; + /* Create a new bond based on the specified name and bonding parameters. * If name is NULL, obtain a suitable "bond%d" name for us. * Caller must NOT hold rtnl_lock; we need to release it here before we @@ -5086,6 +5087,8 @@ int bond_create(const char *name) goto out; } + bond_dev->rtnl_link_ops = &bond_link_ops; + if (!name) { res = dev_alloc_name(bond_dev, "bond%d"); if (res < 0) @@ -5115,6 +5118,10 @@ static int __init bonding_init(void) bond_create_proc_dir(); + res = rtnl_link_register(&bond_link_ops); + if (res) + goto err; + for (i = 0; i < max_bonds; i++) { res = bond_create(NULL); if (res) @@ -5128,14 +5135,12 @@ static int __init bonding_init(void) register_netdevice_notifier(&bond_netdev_notifier); register_inetaddr_notifier(&bond_inetaddr_notifier); bond_register_ipv6_notifier(); - - goto out; -err: - rtnl_lock(); - bond_free_all(); - rtnl_unlock(); out: return res; +err: + rtnl_link_unregister(&bond_link_ops); + bond_destroy_proc_dir(); + goto out; } @@ -5147,9 +5152,8 @@ static void __exit bonding_exit(void) bond_destroy_sysfs(); - rtnl_lock(); - bond_free_all(); - rtnl_unlock(); + rtnl_link_unregister(&bond_link_ops); + bond_destroy_proc_dir(); } module_init(bonding_init); @@ -5158,3 +5162,4 @@ MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); MODULE_DESCRIPTION(DRV_DESCRIPTION ", v" DRV_VERSION); MODULE_AUTHOR("Thomas Davis, tadavis@lbl.gov and many others"); +MODULE_ALIAS_RTNL_LINK("bond");