]> err.no Git - linux-2.6/commit
bonding: Deadlock between bonding_store_bonds and bond_destroy_sysfs.
authorPavel Emelyanov <xemul@openvz.org>
Sat, 3 May 2008 00:49:39 +0000 (17:49 -0700)
committerJeff Garzik <jgarzik@redhat.com>
Tue, 6 May 2008 16:01:30 +0000 (12:01 -0400)
commitae68c39819ddf30549652962768a50edae5eec6f
tree0d0ef28152945ad23b72f6cff62a8dfc0345224b
parentc4ebc66a1a8e3576322a9f47f0d06ec3c96a08d7
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>
drivers/net/bonding/bond_main.c