diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-12-13 13:43:27 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-11 19:28:30 -0500 |
commit | d8bf541e657824cb03effd726ac96e2f4dcf58a5 (patch) | |
tree | 9f51f1c8a8a538692fb1efc16db285baf22cbc23 | |
parent | b3a7ea8d50f6028964b468d13a095dfb2508b2fb (diff) |
[SCSI] iscsi class: Use our own workq instead of common system one.
There is just too much going on through the common workq and
something like a scsi device removal through sysfs affects
how long it will take to recover the transport, mark it as
failed, or shut it down gracefully.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 75d3069ecaa0..9cc2cc8e87b3 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -50,6 +50,7 @@ struct iscsi_internal { | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ | 52 | static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ |
53 | static struct workqueue_struct *iscsi_eh_timer_workq; | ||
53 | 54 | ||
54 | /* | 55 | /* |
55 | * list of registered transports and lock that must | 56 | * list of registered transports and lock that must |
@@ -252,7 +253,7 @@ static void session_recovery_timedout(struct work_struct *work) | |||
252 | void iscsi_unblock_session(struct iscsi_cls_session *session) | 253 | void iscsi_unblock_session(struct iscsi_cls_session *session) |
253 | { | 254 | { |
254 | if (!cancel_delayed_work(&session->recovery_work)) | 255 | if (!cancel_delayed_work(&session->recovery_work)) |
255 | flush_scheduled_work(); | 256 | flush_workqueue(iscsi_eh_timer_workq); |
256 | scsi_target_unblock(&session->dev); | 257 | scsi_target_unblock(&session->dev); |
257 | } | 258 | } |
258 | EXPORT_SYMBOL_GPL(iscsi_unblock_session); | 259 | EXPORT_SYMBOL_GPL(iscsi_unblock_session); |
@@ -260,8 +261,8 @@ EXPORT_SYMBOL_GPL(iscsi_unblock_session); | |||
260 | void iscsi_block_session(struct iscsi_cls_session *session) | 261 | void iscsi_block_session(struct iscsi_cls_session *session) |
261 | { | 262 | { |
262 | scsi_target_block(&session->dev); | 263 | scsi_target_block(&session->dev); |
263 | schedule_delayed_work(&session->recovery_work, | 264 | queue_delayed_work(iscsi_eh_timer_workq, &session->recovery_work, |
264 | session->recovery_tmo * HZ); | 265 | session->recovery_tmo * HZ); |
265 | } | 266 | } |
266 | EXPORT_SYMBOL_GPL(iscsi_block_session); | 267 | EXPORT_SYMBOL_GPL(iscsi_block_session); |
267 | 268 | ||
@@ -357,7 +358,7 @@ void iscsi_remove_session(struct iscsi_cls_session *session) | |||
357 | struct iscsi_host *ihost = shost->shost_data; | 358 | struct iscsi_host *ihost = shost->shost_data; |
358 | 359 | ||
359 | if (!cancel_delayed_work(&session->recovery_work)) | 360 | if (!cancel_delayed_work(&session->recovery_work)) |
360 | flush_scheduled_work(); | 361 | flush_workqueue(iscsi_eh_timer_workq); |
361 | 362 | ||
362 | mutex_lock(&ihost->mutex); | 363 | mutex_lock(&ihost->mutex); |
363 | list_del(&session->host_list); | 364 | list_del(&session->host_list); |
@@ -1521,8 +1522,14 @@ static __init int iscsi_transport_init(void) | |||
1521 | goto unregister_session_class; | 1522 | goto unregister_session_class; |
1522 | } | 1523 | } |
1523 | 1524 | ||
1525 | iscsi_eh_timer_workq = create_singlethread_workqueue("iscsi_eh"); | ||
1526 | if (!iscsi_eh_timer_workq) | ||
1527 | goto release_nls; | ||
1528 | |||
1524 | return 0; | 1529 | return 0; |
1525 | 1530 | ||
1531 | release_nls: | ||
1532 | sock_release(nls->sk_socket); | ||
1526 | unregister_session_class: | 1533 | unregister_session_class: |
1527 | transport_class_unregister(&iscsi_session_class); | 1534 | transport_class_unregister(&iscsi_session_class); |
1528 | unregister_conn_class: | 1535 | unregister_conn_class: |
@@ -1536,6 +1543,7 @@ unregister_transport_class: | |||
1536 | 1543 | ||
1537 | static void __exit iscsi_transport_exit(void) | 1544 | static void __exit iscsi_transport_exit(void) |
1538 | { | 1545 | { |
1546 | destroy_workqueue(iscsi_eh_timer_workq); | ||
1539 | sock_release(nls->sk_socket); | 1547 | sock_release(nls->sk_socket); |
1540 | transport_class_unregister(&iscsi_connection_class); | 1548 | transport_class_unregister(&iscsi_connection_class); |
1541 | transport_class_unregister(&iscsi_session_class); | 1549 | transport_class_unregister(&iscsi_session_class); |