diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 75c9297694cb..4f22f9e37c5a 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -246,30 +246,13 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, | |||
246 | memset(ihost, 0, sizeof(*ihost)); | 246 | memset(ihost, 0, sizeof(*ihost)); |
247 | atomic_set(&ihost->nr_scans, 0); | 247 | atomic_set(&ihost->nr_scans, 0); |
248 | mutex_init(&ihost->mutex); | 248 | mutex_init(&ihost->mutex); |
249 | |||
250 | snprintf(ihost->scan_workq_name, sizeof(ihost->scan_workq_name), | ||
251 | "iscsi_scan_%d", shost->host_no); | ||
252 | ihost->scan_workq = create_singlethread_workqueue( | ||
253 | ihost->scan_workq_name); | ||
254 | if (!ihost->scan_workq) | ||
255 | return -ENOMEM; | ||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | static int iscsi_remove_host(struct transport_container *tc, struct device *dev, | ||
260 | struct device *cdev) | ||
261 | { | ||
262 | struct Scsi_Host *shost = dev_to_shost(dev); | ||
263 | struct iscsi_cls_host *ihost = shost->shost_data; | ||
264 | |||
265 | destroy_workqueue(ihost->scan_workq); | ||
266 | return 0; | 249 | return 0; |
267 | } | 250 | } |
268 | 251 | ||
269 | static DECLARE_TRANSPORT_CLASS(iscsi_host_class, | 252 | static DECLARE_TRANSPORT_CLASS(iscsi_host_class, |
270 | "iscsi_host", | 253 | "iscsi_host", |
271 | iscsi_setup_host, | 254 | iscsi_setup_host, |
272 | iscsi_remove_host, | 255 | NULL, |
273 | NULL); | 256 | NULL); |
274 | 257 | ||
275 | static DECLARE_TRANSPORT_CLASS(iscsi_session_class, | 258 | static DECLARE_TRANSPORT_CLASS(iscsi_session_class, |
@@ -568,7 +551,7 @@ static void __iscsi_unblock_session(struct work_struct *work) | |||
568 | * scanning from userspace). | 551 | * scanning from userspace). |
569 | */ | 552 | */ |
570 | if (shost->hostt->scan_finished) { | 553 | if (shost->hostt->scan_finished) { |
571 | if (queue_work(ihost->scan_workq, &session->scan_work)) | 554 | if (scsi_queue_work(shost, &session->scan_work)) |
572 | atomic_inc(&ihost->nr_scans); | 555 | atomic_inc(&ihost->nr_scans); |
573 | } | 556 | } |
574 | } | 557 | } |
@@ -636,14 +619,6 @@ static void __iscsi_unbind_session(struct work_struct *work) | |||
636 | iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION); | 619 | iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION); |
637 | } | 620 | } |
638 | 621 | ||
639 | static int iscsi_unbind_session(struct iscsi_cls_session *session) | ||
640 | { | ||
641 | struct Scsi_Host *shost = iscsi_session_to_shost(session); | ||
642 | struct iscsi_cls_host *ihost = shost->shost_data; | ||
643 | |||
644 | return queue_work(ihost->scan_workq, &session->unbind_work); | ||
645 | } | ||
646 | |||
647 | struct iscsi_cls_session * | 622 | struct iscsi_cls_session * |
648 | iscsi_alloc_session(struct Scsi_Host *shost, struct iscsi_transport *transport, | 623 | iscsi_alloc_session(struct Scsi_Host *shost, struct iscsi_transport *transport, |
649 | int dd_size) | 624 | int dd_size) |
@@ -796,7 +771,6 @@ static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data) | |||
796 | void iscsi_remove_session(struct iscsi_cls_session *session) | 771 | void iscsi_remove_session(struct iscsi_cls_session *session) |
797 | { | 772 | { |
798 | struct Scsi_Host *shost = iscsi_session_to_shost(session); | 773 | struct Scsi_Host *shost = iscsi_session_to_shost(session); |
799 | struct iscsi_cls_host *ihost = shost->shost_data; | ||
800 | unsigned long flags; | 774 | unsigned long flags; |
801 | int err; | 775 | int err; |
802 | 776 | ||
@@ -821,7 +795,7 @@ void iscsi_remove_session(struct iscsi_cls_session *session) | |||
821 | 795 | ||
822 | scsi_target_unblock(&session->dev); | 796 | scsi_target_unblock(&session->dev); |
823 | /* flush running scans then delete devices */ | 797 | /* flush running scans then delete devices */ |
824 | flush_workqueue(ihost->scan_workq); | 798 | scsi_flush_work(shost); |
825 | __iscsi_unbind_session(&session->unbind_work); | 799 | __iscsi_unbind_session(&session->unbind_work); |
826 | 800 | ||
827 | /* hw iscsi may not have removed all connections from session */ | 801 | /* hw iscsi may not have removed all connections from session */ |
@@ -1447,7 +1421,8 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
1447 | case ISCSI_UEVENT_UNBIND_SESSION: | 1421 | case ISCSI_UEVENT_UNBIND_SESSION: |
1448 | session = iscsi_session_lookup(ev->u.d_session.sid); | 1422 | session = iscsi_session_lookup(ev->u.d_session.sid); |
1449 | if (session) | 1423 | if (session) |
1450 | iscsi_unbind_session(session); | 1424 | scsi_queue_work(iscsi_session_to_shost(session), |
1425 | &session->unbind_work); | ||
1451 | else | 1426 | else |
1452 | err = -EINVAL; | 1427 | err = -EINVAL; |
1453 | break; | 1428 | break; |
@@ -1809,8 +1784,7 @@ iscsi_register_transport(struct iscsi_transport *tt) | |||
1809 | priv->daemon_pid = -1; | 1784 | priv->daemon_pid = -1; |
1810 | priv->iscsi_transport = tt; | 1785 | priv->iscsi_transport = tt; |
1811 | priv->t.user_scan = iscsi_user_scan; | 1786 | priv->t.user_scan = iscsi_user_scan; |
1812 | if (!(tt->caps & CAP_DATA_PATH_OFFLOAD)) | 1787 | priv->t.create_work_queue = 1; |
1813 | priv->t.create_work_queue = 1; | ||
1814 | 1788 | ||
1815 | priv->dev.class = &iscsi_transport_class; | 1789 | priv->dev.class = &iscsi_transport_class; |
1816 | dev_set_name(&priv->dev, "%s", tt->name); | 1790 | dev_set_name(&priv->dev, "%s", tt->name); |