forked from Minki/linux
qeth: serialize sysfs-triggered device configurations
This patch serializes device removal and other sysfs-triggered configurations by moving removal of sysfs-attributes to the beginning of the remove functions. And it serializes online/offline setting and discipline-switching (causing reestablishing of the net_device) by making use of a new discipline mutex. Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
75e0de1363
commit
9dc48ccc68
@ -747,6 +747,7 @@ struct qeth_card {
|
|||||||
struct qdio_ssqd_desc ssqd;
|
struct qdio_ssqd_desc ssqd;
|
||||||
debug_info_t *debug;
|
debug_info_t *debug;
|
||||||
struct mutex conf_mutex;
|
struct mutex conf_mutex;
|
||||||
|
struct mutex discipline_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct qeth_card_list_struct {
|
struct qeth_card_list_struct {
|
||||||
|
@ -1084,6 +1084,7 @@ static int qeth_setup_card(struct qeth_card *card)
|
|||||||
spin_lock_init(&card->ip_lock);
|
spin_lock_init(&card->ip_lock);
|
||||||
spin_lock_init(&card->thread_mask_lock);
|
spin_lock_init(&card->thread_mask_lock);
|
||||||
mutex_init(&card->conf_mutex);
|
mutex_init(&card->conf_mutex);
|
||||||
|
mutex_init(&card->discipline_mutex);
|
||||||
card->thread_start_mask = 0;
|
card->thread_start_mask = 0;
|
||||||
card->thread_allowed_mask = 0;
|
card->thread_allowed_mask = 0;
|
||||||
card->thread_running_mask = 0;
|
card->thread_running_mask = 0;
|
||||||
@ -4348,16 +4349,18 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev)
|
|||||||
struct qeth_card *card = dev_get_drvdata(&gdev->dev);
|
struct qeth_card *card = dev_get_drvdata(&gdev->dev);
|
||||||
|
|
||||||
QETH_DBF_TEXT(SETUP, 2, "removedv");
|
QETH_DBF_TEXT(SETUP, 2, "removedv");
|
||||||
if (card->discipline.ccwgdriver) {
|
|
||||||
card->discipline.ccwgdriver->remove(gdev);
|
|
||||||
qeth_core_free_discipline(card);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (card->info.type == QETH_CARD_TYPE_OSN) {
|
if (card->info.type == QETH_CARD_TYPE_OSN) {
|
||||||
qeth_core_remove_osn_attributes(&gdev->dev);
|
qeth_core_remove_osn_attributes(&gdev->dev);
|
||||||
} else {
|
} else {
|
||||||
qeth_core_remove_device_attributes(&gdev->dev);
|
qeth_core_remove_device_attributes(&gdev->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (card->discipline.ccwgdriver) {
|
||||||
|
card->discipline.ccwgdriver->remove(gdev);
|
||||||
|
qeth_core_free_discipline(card);
|
||||||
|
}
|
||||||
|
|
||||||
debug_unregister(card->debug);
|
debug_unregister(card->debug);
|
||||||
write_lock_irqsave(&qeth_core_card_list.rwlock, flags);
|
write_lock_irqsave(&qeth_core_card_list.rwlock, flags);
|
||||||
list_del(&card->list);
|
list_del(&card->list);
|
||||||
|
@ -411,7 +411,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
|
|||||||
if (!card)
|
if (!card)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
mutex_lock(&card->conf_mutex);
|
mutex_lock(&card->discipline_mutex);
|
||||||
if (card->state != CARD_STATE_DOWN) {
|
if (card->state != CARD_STATE_DOWN) {
|
||||||
rc = -EPERM;
|
rc = -EPERM;
|
||||||
goto out;
|
goto out;
|
||||||
@ -446,7 +446,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
|
|||||||
|
|
||||||
rc = card->discipline.ccwgdriver->probe(card->gdev);
|
rc = card->discipline.ccwgdriver->probe(card->gdev);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&card->conf_mutex);
|
mutex_unlock(&card->discipline_mutex);
|
||||||
return rc ? rc : count;
|
return rc ? rc : count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,6 +935,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
|
|||||||
enum qeth_card_states recover_flag;
|
enum qeth_card_states recover_flag;
|
||||||
|
|
||||||
BUG_ON(!card);
|
BUG_ON(!card);
|
||||||
|
mutex_lock(&card->discipline_mutex);
|
||||||
mutex_lock(&card->conf_mutex);
|
mutex_lock(&card->conf_mutex);
|
||||||
QETH_DBF_TEXT(SETUP, 2, "setonlin");
|
QETH_DBF_TEXT(SETUP, 2, "setonlin");
|
||||||
QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
|
QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
|
||||||
@ -1012,6 +1013,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
|
|||||||
kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);
|
kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&card->conf_mutex);
|
mutex_unlock(&card->conf_mutex);
|
||||||
|
mutex_unlock(&card->discipline_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_remove:
|
out_remove:
|
||||||
@ -1025,6 +1027,7 @@ out_remove:
|
|||||||
else
|
else
|
||||||
card->state = CARD_STATE_DOWN;
|
card->state = CARD_STATE_DOWN;
|
||||||
mutex_unlock(&card->conf_mutex);
|
mutex_unlock(&card->conf_mutex);
|
||||||
|
mutex_unlock(&card->discipline_mutex);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1040,6 +1043,7 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev,
|
|||||||
int rc = 0, rc2 = 0, rc3 = 0;
|
int rc = 0, rc2 = 0, rc3 = 0;
|
||||||
enum qeth_card_states recover_flag;
|
enum qeth_card_states recover_flag;
|
||||||
|
|
||||||
|
mutex_lock(&card->discipline_mutex);
|
||||||
mutex_lock(&card->conf_mutex);
|
mutex_lock(&card->conf_mutex);
|
||||||
QETH_DBF_TEXT(SETUP, 3, "setoffl");
|
QETH_DBF_TEXT(SETUP, 3, "setoffl");
|
||||||
QETH_DBF_HEX(SETUP, 3, &card, sizeof(void *));
|
QETH_DBF_HEX(SETUP, 3, &card, sizeof(void *));
|
||||||
@ -1060,6 +1064,7 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev,
|
|||||||
/* let user_space know that device is offline */
|
/* let user_space know that device is offline */
|
||||||
kobject_uevent(&cgdev->dev.kobj, KOBJ_CHANGE);
|
kobject_uevent(&cgdev->dev.kobj, KOBJ_CHANGE);
|
||||||
mutex_unlock(&card->conf_mutex);
|
mutex_unlock(&card->conf_mutex);
|
||||||
|
mutex_unlock(&card->discipline_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3354,6 +3354,8 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev)
|
|||||||
{
|
{
|
||||||
struct qeth_card *card = dev_get_drvdata(&cgdev->dev);
|
struct qeth_card *card = dev_get_drvdata(&cgdev->dev);
|
||||||
|
|
||||||
|
qeth_l3_remove_device_attributes(&cgdev->dev);
|
||||||
|
|
||||||
qeth_set_allowed_threads(card, 0, 1);
|
qeth_set_allowed_threads(card, 0, 1);
|
||||||
wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0);
|
wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0);
|
||||||
|
|
||||||
@ -3367,7 +3369,6 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev)
|
|||||||
card->dev = NULL;
|
card->dev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
qeth_l3_remove_device_attributes(&cgdev->dev);
|
|
||||||
qeth_l3_clear_ip_list(card, 0, 0);
|
qeth_l3_clear_ip_list(card, 0, 0);
|
||||||
qeth_l3_clear_ipato_list(card);
|
qeth_l3_clear_ipato_list(card);
|
||||||
return;
|
return;
|
||||||
@ -3380,6 +3381,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
|
|||||||
enum qeth_card_states recover_flag;
|
enum qeth_card_states recover_flag;
|
||||||
|
|
||||||
BUG_ON(!card);
|
BUG_ON(!card);
|
||||||
|
mutex_lock(&card->discipline_mutex);
|
||||||
mutex_lock(&card->conf_mutex);
|
mutex_lock(&card->conf_mutex);
|
||||||
QETH_DBF_TEXT(SETUP, 2, "setonlin");
|
QETH_DBF_TEXT(SETUP, 2, "setonlin");
|
||||||
QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
|
QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
|
||||||
@ -3461,6 +3463,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
|
|||||||
kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);
|
kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&card->conf_mutex);
|
mutex_unlock(&card->conf_mutex);
|
||||||
|
mutex_unlock(&card->discipline_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
out_remove:
|
out_remove:
|
||||||
card->use_hard_stop = 1;
|
card->use_hard_stop = 1;
|
||||||
@ -3473,6 +3476,7 @@ out_remove:
|
|||||||
else
|
else
|
||||||
card->state = CARD_STATE_DOWN;
|
card->state = CARD_STATE_DOWN;
|
||||||
mutex_unlock(&card->conf_mutex);
|
mutex_unlock(&card->conf_mutex);
|
||||||
|
mutex_unlock(&card->discipline_mutex);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3488,6 +3492,7 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev,
|
|||||||
int rc = 0, rc2 = 0, rc3 = 0;
|
int rc = 0, rc2 = 0, rc3 = 0;
|
||||||
enum qeth_card_states recover_flag;
|
enum qeth_card_states recover_flag;
|
||||||
|
|
||||||
|
mutex_lock(&card->discipline_mutex);
|
||||||
mutex_lock(&card->conf_mutex);
|
mutex_lock(&card->conf_mutex);
|
||||||
QETH_DBF_TEXT(SETUP, 3, "setoffl");
|
QETH_DBF_TEXT(SETUP, 3, "setoffl");
|
||||||
QETH_DBF_HEX(SETUP, 3, &card, sizeof(void *));
|
QETH_DBF_HEX(SETUP, 3, &card, sizeof(void *));
|
||||||
@ -3508,6 +3513,7 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev,
|
|||||||
/* let user_space know that device is offline */
|
/* let user_space know that device is offline */
|
||||||
kobject_uevent(&cgdev->dev.kobj, KOBJ_CHANGE);
|
kobject_uevent(&cgdev->dev.kobj, KOBJ_CHANGE);
|
||||||
mutex_unlock(&card->conf_mutex);
|
mutex_unlock(&card->conf_mutex);
|
||||||
|
mutex_unlock(&card->discipline_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user