From: michaelc@cs.wisc.edu
To: linux-scsi@vger.kernel.org
Cc: Mike Christie <michaelc@cs.wisc.edu>
Subject: [PATCH 08/14] iscsi class: fix lock dep warning on logout
Date: Thu, 5 Mar 2009 14:46:02 -0600 [thread overview]
Message-ID: <1236285975607-git-send-email-michaelc@cs.wisc.edu> (raw)
In-Reply-To: <12362859754088-git-send-email-michaelc@cs.wisc.edu>
From: Mike Christie <michaelc@cs.wisc.edu>
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>
---
drivers/scsi/scsi_transport_iscsi.c | 38 +++++-----------------------------
include/scsi/scsi_transport_iscsi.h | 2 -
2 files changed, 6 insertions(+), 34 deletions(-)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 75c9297..4f22f9e 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,
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,
- iscsi_remove_host,
+ NULL,
NULL);
static DECLARE_TRANSPORT_CLASS(iscsi_session_class,
@@ -568,7 +551,7 @@ static void __iscsi_unblock_session(struct work_struct *work)
* 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);
}
}
@@ -636,14 +619,6 @@ static void __iscsi_unbind_session(struct work_struct *work)
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)
@@ -796,7 +771,6 @@ static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data)
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;
@@ -821,7 +795,7 @@ void iscsi_remove_session(struct iscsi_cls_session *session)
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 */
@@ -1447,7 +1421,8 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
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;
@@ -1809,8 +1784,7 @@ iscsi_register_transport(struct iscsi_transport *tt)
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);
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index b50aabe..ac29fbd 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -206,8 +206,6 @@ struct iscsi_cls_session {
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,
--
1.6.0.6
next prev parent reply other threads:[~2009-03-05 20:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-05 20:45 iscsi update for 2.6.30 michaelc
2009-03-05 20:45 ` [PATCH 01/14] libiscsi: fix iscsi pool error path michaelc
2009-03-05 20:45 ` [PATCH 02/14] iscsi tcp: bidi capable michaelc
2009-03-05 20:45 ` [PATCH 03/14] iser: have iser use its own logging michaelc
2009-03-05 20:45 ` [PATCH 04/14] libiscsi: replace scsi_debug logging with session/conn logging michaelc
2009-03-05 20:45 ` [PATCH 05/14] libiscsi_tcp: replace tcp_debug/scsi_debug " michaelc
2009-03-05 20:46 ` [PATCH 06/14] iscsi_tcp: replace scsi_debug/tcp_debug logging with iscsi conn logging michaelc
2009-03-05 20:46 ` [PATCH 07/14] libiscsi: don't cap queue depth in iscsi modules michaelc
2009-03-05 20:46 ` michaelc [this message]
2009-03-05 20:46 ` [PATCH 09/14] iscsi lib: have lib create work queue for transmitting IO michaelc
2009-03-05 20:46 ` [PATCH 10/14] iscsi lib: remove qdepth param from iscsi host allocation michaelc
2009-03-05 20:46 ` [PATCH 11/14] libiscsi: pass session failure a session struct michaelc
2009-03-05 20:46 ` [PATCH 12/14] iscsi class: remove host no argument from session creation callout michaelc
2009-03-05 20:46 ` [PATCH 13/14] libiscsi: fix possbile null ptr session command cleanup michaelc
2009-03-05 20:46 ` [PATCH 14/14] cxgb3i - fixed function descriptions michaelc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1236285975607-git-send-email-michaelc@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.