diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-07-09 06:51:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-09 17:49:15 -0400 |
commit | a64d49c3dd504b685f9742a2f3dcb11fb8e4345f (patch) | |
tree | 2cb1d88c6a958f52c51a3785ea266c1533d695f4 /drivers/net/bonding/bond_main.c | |
parent | 684901a6df1fb91fc9a2bdb89ffbebb241428d78 (diff) |
bonding: Manage /proc/net/bonding/ entries from the netdev events
It was recently reported that moving a bonding device between network
namespaces causes warnings from /proc. It turns out after the move we
were trying to add and to remove the /proc/net/bonding entries from the
wrong network namespace.
Move the bonding /proc registration code into the NETDEV_REGISTER and
NETDEV_UNREGISTER events where the proc registration and unregistration
will always happen at the right time.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b9c2ae62166d..2ee76993f052 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3227,6 +3227,12 @@ static int bond_master_netdev_event(unsigned long event, | |||
3227 | switch (event) { | 3227 | switch (event) { |
3228 | case NETDEV_CHANGENAME: | 3228 | case NETDEV_CHANGENAME: |
3229 | return bond_event_changename(event_bond); | 3229 | return bond_event_changename(event_bond); |
3230 | case NETDEV_UNREGISTER: | ||
3231 | bond_remove_proc_entry(event_bond); | ||
3232 | break; | ||
3233 | case NETDEV_REGISTER: | ||
3234 | bond_create_proc_entry(event_bond); | ||
3235 | break; | ||
3230 | default: | 3236 | default: |
3231 | break; | 3237 | break; |
3232 | } | 3238 | } |
@@ -4411,8 +4417,6 @@ static void bond_uninit(struct net_device *bond_dev) | |||
4411 | 4417 | ||
4412 | bond_work_cancel_all(bond); | 4418 | bond_work_cancel_all(bond); |
4413 | 4419 | ||
4414 | bond_remove_proc_entry(bond); | ||
4415 | |||
4416 | bond_debug_unregister(bond); | 4420 | bond_debug_unregister(bond); |
4417 | 4421 | ||
4418 | __hw_addr_flush(&bond->mc_list); | 4422 | __hw_addr_flush(&bond->mc_list); |
@@ -4814,7 +4818,6 @@ static int bond_init(struct net_device *bond_dev) | |||
4814 | 4818 | ||
4815 | bond_set_lockdep_class(bond_dev); | 4819 | bond_set_lockdep_class(bond_dev); |
4816 | 4820 | ||
4817 | bond_create_proc_entry(bond); | ||
4818 | list_add_tail(&bond->bond_list, &bn->dev_list); | 4821 | list_add_tail(&bond->bond_list, &bn->dev_list); |
4819 | 4822 | ||
4820 | bond_prepare_sysfs_group(bond); | 4823 | bond_prepare_sysfs_group(bond); |