]> git.baikalelectronics.ru Git - kernel.git/commit
s390/qeth: fix deadlock during recovery
authorJulian Wiedmann <jwi@linux.ibm.com>
Thu, 7 Jan 2021 17:24:40 +0000 (18:24 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 8 Jan 2021 02:54:06 +0000 (18:54 -0800)
commit0b42b521db589c473edd3a93b83732ba1da23483
tree7b05edb9171eb7b35d16ab9b4fccf1c7ed9142ca
parent413ace8d137446fc0fff62393846654350870c4d
s390/qeth: fix deadlock during recovery

When qeth_dev_layer2_store() - holding the discipline_mutex - waits
inside qeth_l*_remove_device() for a qeth_do_reset() thread to complete,
we can hit a deadlock if qeth_do_reset() concurrently calls
qeth_set_online() and thus tries to aquire the discipline_mutex.

Move the discipline_mutex locking outside of qeth_set_online() and
qeth_set_offline(), and turn the discipline into a parameter so that
callers understand the dependency.

To fix the deadlock, we can now relax the locking:
As already established, qeth_l*_remove_device() waits for
qeth_do_reset() to complete. So qeth_do_reset() itself is under no risk
of having card->discipline ripped out while it's running, and thus
doesn't need to take the discipline_mutex.

Fixes: 5ade8c676c59 ("qeth: serialize sysfs-triggered device configurations")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c