diff options
author | Stefan Raspl <raspl@linux.vnet.ibm.com> | 2012-10-15 15:21:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-16 14:41:46 -0400 |
commit | 2efaf5ff7fa2d45debc27cd9b3d235df61d641fb (patch) | |
tree | 9c3e64e8f758b2eb006f08f8ef4bfccedbcbabda /drivers/s390 | |
parent | 1c8161a8249fa32408e3c073f992141c9d257332 (diff) |
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>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/net/qeth_l2_main.c | 11 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 2db409330c21..e67e0258aec5 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -1141,11 +1141,12 @@ static int qeth_l2_recover(void *ptr) | |||
1141 | dev_info(&card->gdev->dev, | 1141 | dev_info(&card->gdev->dev, |
1142 | "Device successfully recovered!\n"); | 1142 | "Device successfully recovered!\n"); |
1143 | else { | 1143 | else { |
1144 | rtnl_lock(); | 1144 | if (rtnl_trylock()) { |
1145 | dev_close(card->dev); | 1145 | dev_close(card->dev); |
1146 | rtnl_unlock(); | 1146 | rtnl_unlock(); |
1147 | dev_warn(&card->gdev->dev, "The qeth device driver " | 1147 | dev_warn(&card->gdev->dev, "The qeth device driver " |
1148 | "failed to recover an error on the device\n"); | 1148 | "failed to recover an error on the device\n"); |
1149 | } | ||
1149 | } | 1150 | } |
1150 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); | 1151 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); |
1151 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); | 1152 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 4cd310cb5bdf..5ba390658498 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -3510,11 +3510,12 @@ static int qeth_l3_recover(void *ptr) | |||
3510 | dev_info(&card->gdev->dev, | 3510 | dev_info(&card->gdev->dev, |
3511 | "Device successfully recovered!\n"); | 3511 | "Device successfully recovered!\n"); |
3512 | else { | 3512 | else { |
3513 | rtnl_lock(); | 3513 | if (rtnl_trylock()) { |
3514 | dev_close(card->dev); | 3514 | dev_close(card->dev); |
3515 | rtnl_unlock(); | 3515 | rtnl_unlock(); |
3516 | dev_warn(&card->gdev->dev, "The qeth device driver " | 3516 | dev_warn(&card->gdev->dev, "The qeth device driver " |
3517 | "failed to recover an error on the device\n"); | 3517 | "failed to recover an error on the device\n"); |
3518 | } | ||
3518 | } | 3519 | } |
3519 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); | 3520 | qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); |
3520 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); | 3521 | qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); |