• Alexandra Winter's avatar
    s390/qeth: Fix deadlock in remove_discipline · ee909d0b
    Alexandra Winter authored
    Problem: qeth_close_dev_handler is a worker that tries to acquire
    card->discipline_mutex via drv->set_offline() in ccwgroup_set_offline().
    Since commit b41b554c
    ("s390/qeth: fix locking for discipline setup / removal")
    qeth_remove_discipline() is called under card->discipline_mutex and
    cancels the work and waits for it to finish.
    
    STOPLAN reception with reason code IPA_RC_VEPA_TO_VEB_TRANSITION is the
    only situation that schedules close_dev_work. In that situation scheduling
    qeth recovery will also result in an offline interface, when resetting the
    isolation mode fails, if the external switch is still set to VEB.
    And since commit 0b9902c1 ("s390/qeth: fix deadlock during recovery")
    qeth recovery does not aquire card->discipline_mutex anymore.
    
    So we accept the longer pathlength of qeth_schedule_recovery in this
    error situation and re-use the existing function.
    
    As a side-benefit this changes the hwtrap to behave like during recovery
    instead of like during a user-triggered set_offline.
    
    Fixes: b41b554c ("s390/qeth: fix locking for discipline setup / removal")
    Signed-off-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
    Acked-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
    Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    ee909d0b
qeth_l2_main.c 66.5 KB