qeth: fix deadlock between recovery and bonding driver
authorStefan Raspl <raspl@linux.vnet.ibm.com>
Mon, 15 Oct 2012 19:21:18 +0000 (19:21 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Oct 2012 18:41:46 +0000 (14:41 -0400)
commit2efaf5ff7fa2d45debc27cd9b3d235df61d641fb
tree9c3e64e8f758b2eb006f08f8ef4bfccedbcbabda
parent1c8161a8249fa32408e3c073f992141c9d257332
qeth: fix deadlock between recovery and bonding driver

The recovery thread, when failing, tears down the respective interface. To do
so, it needs to obtain the rtnl lock first, as the interface configuration is
changed.
If another process tries to modify an interface setting at the same time, that
process can obtain the rtnl lock first, but the respective callback in the qeth
driver will block until recovery has completed - which cannot happen since the
calling process already obtained it.
In one particular case, the bonding driver acquired the rtnl lock to modify the
card's MAC address, while the recovery failed at the same time due to the card
being removed. Hence qeth_l2_set_mac_address (implicitly holding the rtnl lock)
was waiting on qeth_l2_recover, which deadlocked when waiting on the rtnl lock.
This patch uses rtnl_trylock instead of rtnl_lock in the recovery thread. If the
lock cannot be obtained, the interface will be left up, but the card state
remains in CARD_STATE_RECOVER, which will prevent any further activities on the
card.

Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Reviewed-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c