s390/qeth: cancel cmds earlier during teardown

Originators of cmd IO typically hold the rtnl or conf_mutex to protect
against a concurrent teardown.
Since qeth_set_offline() already holds the conf_mutex, the main reason
why we still care about cancelling pending cmds is so that they release
the rtnl when we need it ourselves.

So move this step a little earlier into the teardown sequence.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Julian Wiedmann 2020-09-23 10:36:57 +02:00 committed by David S. Miller
parent f3380b1edc
commit 7fb7fe5c7b
4 changed files with 5 additions and 7 deletions

View File

@ -1067,7 +1067,6 @@ void qeth_put_cmd(struct qeth_cmd_buffer *iob);
int qeth_schedule_recovery(struct qeth_card *card); int qeth_schedule_recovery(struct qeth_card *card);
void qeth_flush_local_addrs(struct qeth_card *card); void qeth_flush_local_addrs(struct qeth_card *card);
int qeth_poll(struct napi_struct *napi, int budget); int qeth_poll(struct napi_struct *napi, int budget);
void qeth_clear_ipacmd_list(struct qeth_card *);
int qeth_qdio_clear_card(struct qeth_card *, int); int qeth_qdio_clear_card(struct qeth_card *, int);
void qeth_clear_working_pool_list(struct qeth_card *); void qeth_clear_working_pool_list(struct qeth_card *);
void qeth_drain_output_queues(struct qeth_card *card); void qeth_drain_output_queues(struct qeth_card *card);

View File

@ -965,7 +965,7 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card,
} }
} }
void qeth_clear_ipacmd_list(struct qeth_card *card) static void qeth_clear_ipacmd_list(struct qeth_card *card)
{ {
struct qeth_cmd_buffer *iob; struct qeth_cmd_buffer *iob;
unsigned long flags; unsigned long flags;
@ -977,7 +977,6 @@ void qeth_clear_ipacmd_list(struct qeth_card *card)
qeth_notify_cmd(iob, -ECANCELED); qeth_notify_cmd(iob, -ECANCELED);
spin_unlock_irqrestore(&card->lock, flags); spin_unlock_irqrestore(&card->lock, flags);
} }
EXPORT_SYMBOL_GPL(qeth_clear_ipacmd_list);
static int qeth_check_idx_response(struct qeth_card *card, static int qeth_check_idx_response(struct qeth_card *card,
unsigned char *buffer) unsigned char *buffer)
@ -5334,6 +5333,9 @@ int qeth_set_offline(struct qeth_card *card, bool resetting)
card->info.hwtrap = 1; card->info.hwtrap = 1;
} }
/* cancel any stalled cmd that might block the rtnl: */
qeth_clear_ipacmd_list(card);
rtnl_lock(); rtnl_lock();
card->info.open_when_online = card->dev->flags & IFF_UP; card->info.open_when_online = card->dev->flags & IFF_UP;
dev_close(card->dev); dev_close(card->dev);

View File

@ -315,10 +315,8 @@ static void qeth_l2_stop_card(struct qeth_card *card)
cancel_work_sync(&card->rx_mode_work); cancel_work_sync(&card->rx_mode_work);
qeth_l2_drain_rx_mode_cache(card); qeth_l2_drain_rx_mode_cache(card);
if (card->state == CARD_STATE_SOFTSETUP) { if (card->state == CARD_STATE_SOFTSETUP)
qeth_clear_ipacmd_list(card);
card->state = CARD_STATE_DOWN; card->state = CARD_STATE_DOWN;
}
qeth_qdio_clear_card(card, 0); qeth_qdio_clear_card(card, 0);
qeth_drain_output_queues(card); qeth_drain_output_queues(card);

View File

@ -1158,7 +1158,6 @@ static void qeth_l3_stop_card(struct qeth_card *card)
if (card->state == CARD_STATE_SOFTSETUP) { if (card->state == CARD_STATE_SOFTSETUP) {
card->state = CARD_STATE_DOWN; card->state = CARD_STATE_DOWN;
qeth_l3_clear_ip_htable(card, 1); qeth_l3_clear_ip_htable(card, 1);
qeth_clear_ipacmd_list(card);
} }
qeth_qdio_clear_card(card, 0); qeth_qdio_clear_card(card, 0);