Commit b52d3161 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 's390-qeth-fixes-2021-09-21'

Julian Wiedmann says:

====================
s390/qeth: fixes 2021-09-21

This brings two fixes for deadlocks when a device is removed while it
has certain types of async work pending. And one additional fix for a
missing NULL check in an error case.
====================

Link: https://lore.kernel.org/r/20210921145217.1584654-1-jwi@linux.ibm.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents b3f98404 d2b59bd4
...@@ -55,7 +55,7 @@ int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv, ...@@ -55,7 +55,7 @@ int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv,
int num_devices, const char *buf); int num_devices, const char *buf);
extern int ccwgroup_set_online(struct ccwgroup_device *gdev); extern int ccwgroup_set_online(struct ccwgroup_device *gdev);
extern int ccwgroup_set_offline(struct ccwgroup_device *gdev); int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv);
extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev); extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
......
...@@ -77,12 +77,13 @@ EXPORT_SYMBOL(ccwgroup_set_online); ...@@ -77,12 +77,13 @@ EXPORT_SYMBOL(ccwgroup_set_online);
/** /**
* ccwgroup_set_offline() - disable a ccwgroup device * ccwgroup_set_offline() - disable a ccwgroup device
* @gdev: target ccwgroup device * @gdev: target ccwgroup device
* @call_gdrv: Call the registered gdrv set_offline function
* *
* This function attempts to put the ccwgroup device into the offline state. * This function attempts to put the ccwgroup device into the offline state.
* Returns: * Returns:
* %0 on success and a negative error value on failure. * %0 on success and a negative error value on failure.
*/ */
int ccwgroup_set_offline(struct ccwgroup_device *gdev) int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv)
{ {
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
int ret = -EINVAL; int ret = -EINVAL;
...@@ -91,11 +92,16 @@ int ccwgroup_set_offline(struct ccwgroup_device *gdev) ...@@ -91,11 +92,16 @@ int ccwgroup_set_offline(struct ccwgroup_device *gdev)
return -EAGAIN; return -EAGAIN;
if (gdev->state == CCWGROUP_OFFLINE) if (gdev->state == CCWGROUP_OFFLINE)
goto out; goto out;
if (!call_gdrv) {
ret = 0;
goto offline;
}
if (gdrv->set_offline) if (gdrv->set_offline)
ret = gdrv->set_offline(gdev); ret = gdrv->set_offline(gdev);
if (ret) if (ret)
goto out; goto out;
offline:
gdev->state = CCWGROUP_OFFLINE; gdev->state = CCWGROUP_OFFLINE;
out: out:
atomic_set(&gdev->onoff, 0); atomic_set(&gdev->onoff, 0);
...@@ -124,7 +130,7 @@ static ssize_t ccwgroup_online_store(struct device *dev, ...@@ -124,7 +130,7 @@ static ssize_t ccwgroup_online_store(struct device *dev,
if (value == 1) if (value == 1)
ret = ccwgroup_set_online(gdev); ret = ccwgroup_set_online(gdev);
else if (value == 0) else if (value == 0)
ret = ccwgroup_set_offline(gdev); ret = ccwgroup_set_offline(gdev, true);
else else
ret = -EINVAL; ret = -EINVAL;
out: out:
......
...@@ -858,7 +858,6 @@ struct qeth_card { ...@@ -858,7 +858,6 @@ struct qeth_card {
struct napi_struct napi; struct napi_struct napi;
struct qeth_rx rx; struct qeth_rx rx;
struct delayed_work buffer_reclaim_work; struct delayed_work buffer_reclaim_work;
struct work_struct close_dev_work;
}; };
static inline bool qeth_card_hw_is_reachable(struct qeth_card *card) static inline bool qeth_card_hw_is_reachable(struct qeth_card *card)
......
...@@ -70,15 +70,6 @@ static void qeth_issue_next_read_cb(struct qeth_card *card, ...@@ -70,15 +70,6 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
static int qeth_qdio_establish(struct qeth_card *); static int qeth_qdio_establish(struct qeth_card *);
static void qeth_free_qdio_queues(struct qeth_card *card); static void qeth_free_qdio_queues(struct qeth_card *card);
static void qeth_close_dev_handler(struct work_struct *work)
{
struct qeth_card *card;
card = container_of(work, struct qeth_card, close_dev_work);
QETH_CARD_TEXT(card, 2, "cldevhdl");
ccwgroup_set_offline(card->gdev);
}
static const char *qeth_get_cardname(struct qeth_card *card) static const char *qeth_get_cardname(struct qeth_card *card)
{ {
if (IS_VM_NIC(card)) { if (IS_VM_NIC(card)) {
...@@ -202,6 +193,9 @@ static void qeth_clear_working_pool_list(struct qeth_card *card) ...@@ -202,6 +193,9 @@ static void qeth_clear_working_pool_list(struct qeth_card *card)
&card->qdio.in_buf_pool.entry_list, list) &card->qdio.in_buf_pool.entry_list, list)
list_del(&pool_entry->list); list_del(&pool_entry->list);
if (!queue)
return;
for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) for (i = 0; i < ARRAY_SIZE(queue->bufs); i++)
queue->bufs[i].pool_entry = NULL; queue->bufs[i].pool_entry = NULL;
} }
...@@ -792,10 +786,12 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card, ...@@ -792,10 +786,12 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card,
case IPA_CMD_STOPLAN: case IPA_CMD_STOPLAN:
if (cmd->hdr.return_code == IPA_RC_VEPA_TO_VEB_TRANSITION) { if (cmd->hdr.return_code == IPA_RC_VEPA_TO_VEB_TRANSITION) {
dev_err(&card->gdev->dev, dev_err(&card->gdev->dev,
"Interface %s is down because the adjacent port is no longer in reflective relay mode\n", "Adjacent port of interface %s is no longer in reflective relay mode, trigger recovery\n",
netdev_name(card->dev)); netdev_name(card->dev));
schedule_work(&card->close_dev_work); /* Set offline, then probably fail to set online: */
qeth_schedule_recovery(card);
} else { } else {
/* stay online for subsequent STARTLAN */
dev_warn(&card->gdev->dev, dev_warn(&card->gdev->dev,
"The link for interface %s on CHPID 0x%X failed\n", "The link for interface %s on CHPID 0x%X failed\n",
netdev_name(card->dev), card->info.chpid); netdev_name(card->dev), card->info.chpid);
...@@ -1537,7 +1533,6 @@ static void qeth_setup_card(struct qeth_card *card) ...@@ -1537,7 +1533,6 @@ static void qeth_setup_card(struct qeth_card *card)
INIT_LIST_HEAD(&card->ipato.entries); INIT_LIST_HEAD(&card->ipato.entries);
qeth_init_qdio_info(card); qeth_init_qdio_info(card);
INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work); INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work);
INIT_WORK(&card->close_dev_work, qeth_close_dev_handler);
hash_init(card->rx_mode_addrs); hash_init(card->rx_mode_addrs);
hash_init(card->local_addrs4); hash_init(card->local_addrs4);
hash_init(card->local_addrs6); hash_init(card->local_addrs6);
...@@ -5519,7 +5514,8 @@ static int qeth_do_reset(void *data) ...@@ -5519,7 +5514,8 @@ static int qeth_do_reset(void *data)
dev_info(&card->gdev->dev, dev_info(&card->gdev->dev,
"Device successfully recovered!\n"); "Device successfully recovered!\n");
} else { } else {
ccwgroup_set_offline(card->gdev); qeth_set_offline(card, disc, true);
ccwgroup_set_offline(card->gdev, false);
dev_warn(&card->gdev->dev, dev_warn(&card->gdev->dev,
"The qeth device driver failed to recover an error on the device\n"); "The qeth device driver failed to recover an error on the device\n");
} }
......
...@@ -2307,7 +2307,6 @@ static void qeth_l2_remove_device(struct ccwgroup_device *gdev) ...@@ -2307,7 +2307,6 @@ static void qeth_l2_remove_device(struct ccwgroup_device *gdev)
if (gdev->state == CCWGROUP_ONLINE) if (gdev->state == CCWGROUP_ONLINE)
qeth_set_offline(card, card->discipline, false); qeth_set_offline(card, card->discipline, false);
cancel_work_sync(&card->close_dev_work);
if (card->dev->reg_state == NETREG_REGISTERED) { if (card->dev->reg_state == NETREG_REGISTERED) {
priv = netdev_priv(card->dev); priv = netdev_priv(card->dev);
if (priv->brport_features & BR_LEARNING_SYNC) { if (priv->brport_features & BR_LEARNING_SYNC) {
......
...@@ -1969,7 +1969,6 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) ...@@ -1969,7 +1969,6 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev)
if (cgdev->state == CCWGROUP_ONLINE) if (cgdev->state == CCWGROUP_ONLINE)
qeth_set_offline(card, card->discipline, false); qeth_set_offline(card, card->discipline, false);
cancel_work_sync(&card->close_dev_work);
if (card->dev->reg_state == NETREG_REGISTERED) if (card->dev->reg_state == NETREG_REGISTERED)
unregister_netdev(card->dev); unregister_netdev(card->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment