Skip to content

Commit

Permalink
bonding: Manage /proc/net/bonding/ entries from the netdev events
Browse files Browse the repository at this point in the history
commit a64d49c upstream.

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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Eric W. Biederman authored and Ben Hutchings committed Jul 25, 2012
1 parent 78d40a3 commit cbcdb62
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3184,6 +3184,12 @@ static int bond_master_netdev_event(unsigned long event,
switch (event) {
case NETDEV_CHANGENAME:
return bond_event_changename(event_bond);
case NETDEV_UNREGISTER:
bond_remove_proc_entry(event_bond);
break;
case NETDEV_REGISTER:
bond_create_proc_entry(event_bond);
break;
default:
break;
}
Expand Down Expand Up @@ -4391,8 +4397,6 @@ static void bond_uninit(struct net_device *bond_dev)

bond_work_cancel_all(bond);

bond_remove_proc_entry(bond);

bond_debug_unregister(bond);

__hw_addr_flush(&bond->mc_list);
Expand Down Expand Up @@ -4794,7 +4798,6 @@ static int bond_init(struct net_device *bond_dev)

bond_set_lockdep_class(bond_dev);

bond_create_proc_entry(bond);
list_add_tail(&bond->bond_list, &bn->dev_list);

bond_prepare_sysfs_group(bond);
Expand Down

0 comments on commit cbcdb62

Please sign in to comment.