diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-05-02 20:49:39 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-06 12:01:30 -0400 |
commit | ae68c39819ddf30549652962768a50edae5eec6f (patch) | |
tree | 0d0ef28152945ad23b72f6cff62a8dfc0345224b /drivers/net/bonding | |
parent | c4ebc66a1a8e3576322a9f47f0d06ec3c96a08d7 (diff) |
bonding: Deadlock between bonding_store_bonds and bond_destroy_sysfs.
The sysfs layer has an internal protection, that ensures, that
all the process sitting inside ->sore/->show callback exits
before the appropriate entry is unregistered (the calltraces
are rather big, but I can provide them if required).
On the other hand, bonding takes rtnl_lock in
a) the bonding_store_bonds, i.e. in ->store callback,
b) module exit before calling the sysfs unregister routines.
Thus, the classical AB-BA deadlock may occur. To reproduce run
# while :; do modprobe bonding; rmmod bonding; done
and
# while :; do echo '+bond%d' > /sys/class/net/bonding_masters ; done
in parallel.
The fix is to move the bond_destroy_sysfs out of the rtnl_lock,
but _before_ bond_free_all to make sure no bonding devices exist
after module unload.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 5509732d3f9d..e41b3e57260c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4992,9 +4992,10 @@ err: | |||
4992 | destroy_workqueue(bond->wq); | 4992 | destroy_workqueue(bond->wq); |
4993 | } | 4993 | } |
4994 | 4994 | ||
4995 | bond_destroy_sysfs(); | ||
4996 | |||
4995 | rtnl_lock(); | 4997 | rtnl_lock(); |
4996 | bond_free_all(); | 4998 | bond_free_all(); |
4997 | bond_destroy_sysfs(); | ||
4998 | rtnl_unlock(); | 4999 | rtnl_unlock(); |
4999 | out: | 5000 | out: |
5000 | return res; | 5001 | return res; |
@@ -5006,9 +5007,10 @@ static void __exit bonding_exit(void) | |||
5006 | unregister_netdevice_notifier(&bond_netdev_notifier); | 5007 | unregister_netdevice_notifier(&bond_netdev_notifier); |
5007 | unregister_inetaddr_notifier(&bond_inetaddr_notifier); | 5008 | unregister_inetaddr_notifier(&bond_inetaddr_notifier); |
5008 | 5009 | ||
5010 | bond_destroy_sysfs(); | ||
5011 | |||
5009 | rtnl_lock(); | 5012 | rtnl_lock(); |
5010 | bond_free_all(); | 5013 | bond_free_all(); |
5011 | bond_destroy_sysfs(); | ||
5012 | rtnl_unlock(); | 5014 | rtnl_unlock(); |
5013 | } | 5015 | } |
5014 | 5016 | ||