We never should hit the lock up that is spit out when
lock dep is on and we logout. But we have been using the
shost work queue in a odd way. This patch has us use the
work queue for scanning instead of creating our own,
and this ends up also killing the lock dep warnings.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
memset(ihost, 0, sizeof(*ihost));
atomic_set(&ihost->nr_scans, 0);
mutex_init(&ihost->mutex);
memset(ihost, 0, sizeof(*ihost));
atomic_set(&ihost->nr_scans, 0);
mutex_init(&ihost->mutex);
-
- snprintf(ihost->scan_workq_name, sizeof(ihost->scan_workq_name),
- "iscsi_scan_%d", shost->host_no);
- ihost->scan_workq = create_singlethread_workqueue(
- ihost->scan_workq_name);
- if (!ihost->scan_workq)
- return -ENOMEM;
- return 0;
-}
-
-static int iscsi_remove_host(struct transport_container *tc, struct device *dev,
- struct device *cdev)
-{
- struct Scsi_Host *shost = dev_to_shost(dev);
- struct iscsi_cls_host *ihost = shost->shost_data;
-
- destroy_workqueue(ihost->scan_workq);
return 0;
}
static DECLARE_TRANSPORT_CLASS(iscsi_host_class,
"iscsi_host",
iscsi_setup_host,
return 0;
}
static DECLARE_TRANSPORT_CLASS(iscsi_host_class,
"iscsi_host",
iscsi_setup_host,
NULL);
static DECLARE_TRANSPORT_CLASS(iscsi_session_class,
NULL);
static DECLARE_TRANSPORT_CLASS(iscsi_session_class,
* scanning from userspace).
*/
if (shost->hostt->scan_finished) {
* scanning from userspace).
*/
if (shost->hostt->scan_finished) {
- if (queue_work(ihost->scan_workq, &session->scan_work))
+ if (scsi_queue_work(shost, &session->scan_work))
atomic_inc(&ihost->nr_scans);
}
}
atomic_inc(&ihost->nr_scans);
}
}
iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
}
iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
}
-static int iscsi_unbind_session(struct iscsi_cls_session *session)
-{
- struct Scsi_Host *shost = iscsi_session_to_shost(session);
- struct iscsi_cls_host *ihost = shost->shost_data;
-
- return queue_work(ihost->scan_workq, &session->unbind_work);
-}
-
struct iscsi_cls_session *
iscsi_alloc_session(struct Scsi_Host *shost, struct iscsi_transport *transport,
int dd_size)
struct iscsi_cls_session *
iscsi_alloc_session(struct Scsi_Host *shost, struct iscsi_transport *transport,
int dd_size)
void iscsi_remove_session(struct iscsi_cls_session *session)
{
struct Scsi_Host *shost = iscsi_session_to_shost(session);
void iscsi_remove_session(struct iscsi_cls_session *session)
{
struct Scsi_Host *shost = iscsi_session_to_shost(session);
- struct iscsi_cls_host *ihost = shost->shost_data;
unsigned long flags;
int err;
unsigned long flags;
int err;
scsi_target_unblock(&session->dev);
/* flush running scans then delete devices */
scsi_target_unblock(&session->dev);
/* flush running scans then delete devices */
- flush_workqueue(ihost->scan_workq);
+ scsi_flush_work(shost);
__iscsi_unbind_session(&session->unbind_work);
/* hw iscsi may not have removed all connections from session */
__iscsi_unbind_session(&session->unbind_work);
/* hw iscsi may not have removed all connections from session */
case ISCSI_UEVENT_UNBIND_SESSION:
session = iscsi_session_lookup(ev->u.d_session.sid);
if (session)
case ISCSI_UEVENT_UNBIND_SESSION:
session = iscsi_session_lookup(ev->u.d_session.sid);
if (session)
- iscsi_unbind_session(session);
+ scsi_queue_work(iscsi_session_to_shost(session),
+ &session->unbind_work);
else
err = -EINVAL;
break;
else
err = -EINVAL;
break;
priv->daemon_pid = -1;
priv->iscsi_transport = tt;
priv->t.user_scan = iscsi_user_scan;
priv->daemon_pid = -1;
priv->iscsi_transport = tt;
priv->t.user_scan = iscsi_user_scan;
- if (!(tt->caps & CAP_DATA_PATH_OFFLOAD))
- priv->t.create_work_queue = 1;
+ priv->t.create_work_queue = 1;
priv->dev.class = &iscsi_transport_class;
dev_set_name(&priv->dev, "%s", tt->name);
priv->dev.class = &iscsi_transport_class;
dev_set_name(&priv->dev, "%s", tt->name);
struct iscsi_cls_host {
atomic_t nr_scans;
struct mutex mutex;
struct iscsi_cls_host {
atomic_t nr_scans;
struct mutex mutex;
- struct workqueue_struct *scan_workq;
- char scan_workq_name[20];
};
extern void iscsi_host_for_each_session(struct Scsi_Host *shost,
};
extern void iscsi_host_for_each_session(struct Scsi_Host *shost,