diff options
author | Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com> | 2013-04-12 11:52:08 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-05-02 11:10:20 -0400 |
commit | 56bbe686693df7edcca18d1808edd80609e63c31 (patch) | |
tree | d7dec4848cacf09853f9677d4c8aeebb080050d6 /drivers/s390/crypto | |
parent | 1553556067cd759f4fae8410bdaad33f5add78cc (diff) |
s390/zcrypt: ap bus rescan problem when toggle crypto adapters on/off
The bus rescan process was called simultaneously on
every device failure. This finally leads into race
conditions (double device add/remove actions).
This patch protects the rescan area by mutual exclusion
and improves ap_config_timer handling
Signed-off-by: Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/crypto')
-rw-r--r-- | drivers/s390/crypto/ap_bus.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index b8b340ac5332..9de41aa14896 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -954,15 +954,11 @@ EXPORT_SYMBOL(ap_driver_unregister); | |||
954 | 954 | ||
955 | void ap_bus_force_rescan(void) | 955 | void ap_bus_force_rescan(void) |
956 | { | 956 | { |
957 | /* Delete the AP bus rescan timer. */ | 957 | /* reconfigure the AP bus rescan timer. */ |
958 | del_timer(&ap_config_timer); | 958 | mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ); |
959 | 959 | /* processing a asynchronous bus rescan */ | |
960 | /* processing a synchonuous bus rescan */ | 960 | queue_work(ap_work_queue, &ap_config_work); |
961 | ap_scan_bus(NULL); | 961 | flush_work(&ap_config_work); |
962 | |||
963 | /* Setup the AP bus rescan timer again. */ | ||
964 | ap_config_timer.expires = jiffies + ap_config_time * HZ; | ||
965 | add_timer(&ap_config_timer); | ||
966 | } | 962 | } |
967 | EXPORT_SYMBOL(ap_bus_force_rescan); | 963 | EXPORT_SYMBOL(ap_bus_force_rescan); |
968 | 964 | ||
@@ -1305,8 +1301,9 @@ static void ap_scan_bus(struct work_struct *unused) | |||
1305 | int rc, i; | 1301 | int rc, i; |
1306 | 1302 | ||
1307 | ap_query_configuration(); | 1303 | ap_query_configuration(); |
1308 | if (ap_select_domain() != 0) | 1304 | if (ap_select_domain() != 0) { |
1309 | return; | 1305 | return; |
1306 | } | ||
1310 | for (i = 0; i < AP_DEVICES; i++) { | 1307 | for (i = 0; i < AP_DEVICES; i++) { |
1311 | qid = AP_MKQID(i, ap_domain_index); | 1308 | qid = AP_MKQID(i, ap_domain_index); |
1312 | dev = bus_find_device(&ap_bus_type, NULL, | 1309 | dev = bus_find_device(&ap_bus_type, NULL, |