[ewg] [PATCH 1/2] IB/iser: add iscsi session workqueue for old kernels

Erez Zilber erezz at voltaire.com
Tue Sep 11 06:52:34 PDT 2007


The scsi workqueue does not exist in old kernels (e.g RH4).
For such kernels, a session should have its own queue.

Signed-off-by: Erez Zilber <erezz at voltaire.com>
---
 .../backport/2.6.9_U3/add_iscsi_session_wq.patch   |  135 ++++++++++++++++++++
 .../2.6.9_U3/libiscsi_no_flush_to_2_6_9.patch      |   31 -----
 .../backport/2.6.9_U4/add_iscsi_session_wq.patch   |  135 ++++++++++++++++++++
 .../2.6.9_U4/libiscsi_no_flush_to_2_6_9.patch      |   31 -----
 .../backport/2.6.9_U5/add_iscsi_session_wq.patch   |  135 ++++++++++++++++++++
 .../2.6.9_U5/libiscsi_no_flush_to_2_6_9.patch      |   31 -----
 6 files changed, 405 insertions(+), 93 deletions(-)
 create mode 100644 kernel_patches/backport/2.6.9_U3/add_iscsi_session_wq.patch
 delete mode 100644 kernel_patches/backport/2.6.9_U3/libiscsi_no_flush_to_2_6_9.patch
 create mode 100644 kernel_patches/backport/2.6.9_U4/add_iscsi_session_wq.patch
 delete mode 100644 kernel_patches/backport/2.6.9_U4/libiscsi_no_flush_to_2_6_9.patch
 create mode 100644 kernel_patches/backport/2.6.9_U5/add_iscsi_session_wq.patch
 delete mode 100644 kernel_patches/backport/2.6.9_U5/libiscsi_no_flush_to_2_6_9.patch

diff --git a/kernel_patches/backport/2.6.9_U3/add_iscsi_session_wq.patch b/kernel_patches/backport/2.6.9_U3/add_iscsi_session_wq.patch
new file mode 100644
index 0000000..877952f
--- /dev/null
+++ b/kernel_patches/backport/2.6.9_U3/add_iscsi_session_wq.patch
@@ -0,0 +1,135 @@
+diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
+index 9ea5b9a..751b963 100644
+--- a/drivers/infiniband/ulp/iser/iser_initiator.c
++++ b/drivers/infiniband/ulp/iser/iser_initiator.c
+@@ -612,7 +612,7 @@ void iser_snd_completion(struct iser_desc *tx_desc)
+ 
+ 	if (resume_tx) {
+ 		iser_dbg("%ld resuming tx\n",jiffies);
+-		scsi_queue_work(conn->session->host, &conn->xmitwork);
++		queue_work(conn->session->wq, &conn->xmitwork);
+ 	}
+ 
+ 	if (tx_desc->type == ISCSI_TX_CONTROL) {
+diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
+index a21455d..7f9eb42 100644
+--- a/drivers/scsi/iscsi_tcp.c
++++ b/drivers/scsi/iscsi_tcp.c
+@@ -415,7 +415,7 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
+ 	tcp_ctask->xmstate |= XMSTATE_SOL_HDR_INIT;
+ 	list_move_tail(&ctask->running, &conn->xmitqueue);
+ 
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	conn->r2t_pdus_cnt++;
+ 	spin_unlock(&session->lock);
+ 
+@@ -1044,7 +1044,7 @@ iscsi_write_space(struct sock *sk)
+ 
+ 	tcp_conn->old_write_space(sk);
+ 	debug_tcp("iscsi_write_space: cid %d\n", conn->id);
+-	scsi_queue_work(conn->session->host, &conn->xmitwork);
++	queue_work(conn->session->wq, &conn->xmitwork);
+ }
+ 
+ static void
+diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
+index 5606d1e..1611caf 100644
+--- a/drivers/scsi/libiscsi.c
++++ b/drivers/scsi/libiscsi.c
+@@ -87,8 +87,7 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)
+ 		 */
+ 		if (!list_empty(&session->leadconn->xmitqueue) ||
+ 		    __kfifo_len(session->leadconn->mgmtqueue))
+-			scsi_queue_work(session->host,
+-					&session->leadconn->xmitwork);
++			queue_work(session->wq, &session->leadconn->xmitwork);
+ 	}
+ }
+ EXPORT_SYMBOL_GPL(iscsi_update_cmdsn);
+@@ -863,7 +862,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
+ 	list_add_tail(&ctask->running, &conn->xmitqueue);
+ 	spin_unlock(&session->lock);
+ 
+-	scsi_queue_work(host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	return 0;
+ 
+ reject:
+@@ -942,7 +941,7 @@ int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr,
+ 	if (!__iscsi_conn_send_pdu(conn, hdr, data, data_size))
+ 		err = -EPERM;
+ 	spin_unlock_bh(&session->lock);
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	return err;
+ }
+ EXPORT_SYMBOL_GPL(iscsi_conn_send_pdu);
+@@ -1066,7 +1065,7 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc,
+ 		debug_scsi("abort set timeout [itt 0x%x]\n", ctask->itt);
+ 	}
+ 	spin_unlock_bh(&session->lock);
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 
+ 	/*
+ 	 * block eh thread until:
+@@ -1231,7 +1230,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
+ 		 * make sure xmit thread is not still touching the
+ 		 * ctask/scsi_cmnd
+ 		 */
+-		scsi_flush_work(session->host);
++		flush_workqueue(session->wq);
+ 		goto success_unlocked;
+ 	case TMABORT_NOT_FOUND:
+ 		if (!ctask->sc) {
+@@ -1439,6 +1438,9 @@ iscsi_session_setup(struct iscsi_transport *iscsit,
+ 		INIT_LIST_HEAD(&mtask->running);
+ 	}
+ 
++	session->wq = create_singlethread_workqueue("");
++	BUG_ON(!session->wq);
++
+ 	if (scsi_add_host(shost, NULL))
+ 		goto add_host_fail;
+ 
+@@ -1494,6 +1496,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
+ 	kfree(session->hwaddress);
+ 	kfree(session->initiatorname);
+ 
++	destroy_workqueue(session->wq);
++
+ 	iscsi_destroy_session(cls_session);
+ 	scsi_host_put(shost);
+ 	module_put(owner);
+@@ -1615,7 +1619,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
+ 	}
+ 
+ 	/* flush queued up work because we free the connection below */
+-	scsi_flush_work(session->host);
++	flush_workqueue(session->wq);
+ 
+ 	spin_lock_bh(&session->lock);
+ 	kfree(conn->data);
+@@ -1757,7 +1761,7 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
+ 	conn->c_stage = ISCSI_CONN_STOPPED;
+ 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
+ 	spin_unlock_bh(&session->lock);
+-	scsi_flush_work(session->host);
++	flush_workqueue(session->wq);
+ 
+ 	write_lock_bh(conn->recv_lock);
+ 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
+diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
+index 007d442..7856b2f 100644
+--- a/include/scsi/libiscsi.h
++++ b/include/scsi/libiscsi.h
+@@ -253,6 +253,8 @@ struct iscsi_session {
+ 	int			mgmtpool_max;	/* size of mgmt array */
+ 	struct iscsi_mgmt_task	**mgmt_cmds;	/* Original mgmt arr */
+ 	struct iscsi_queue	mgmtpool;	/* Mgmt PDU's pool */
++	struct workqueue_struct	*wq;		/* workqueue to replace the scsi *
++						 * workqueue in old kernels      */
+ };
+ 
+ /*
diff --git a/kernel_patches/backport/2.6.9_U3/libiscsi_no_flush_to_2_6_9.patch b/kernel_patches/backport/2.6.9_U3/libiscsi_no_flush_to_2_6_9.patch
deleted file mode 100644
index f9b52bd..0000000
--- a/kernel_patches/backport/2.6.9_U3/libiscsi_no_flush_to_2_6_9.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Index: ofed_kernel/drivers/scsi/libiscsi.c
-===================================================================
---- ofed_kernel.orig/drivers/scsi/libiscsi.c	2007-07-25 14:10:53.000000000 +0300
-+++ ofed_kernel/drivers/scsi/libiscsi.c	2007-07-25 14:11:40.000000000 +0300
-@@ -1225,7 +1225,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
- 		 * make sure xmit thread is not still touching the
- 		 * ctask/scsi_cmnd
- 		 */
--		scsi_flush_work(session->host);
-+		/* scsi_flush_work(session->host); */
- 		goto success_unlocked;
- 	case TMABORT_NOT_FOUND:
- 		if (!ctask->sc) {
-@@ -1608,7 +1608,7 @@ void iscsi_conn_teardown(struct iscsi_cl
- 	}
- 
- 	/* flush queued up work because we free the connection below */
--	scsi_flush_work(session->host);
-+	/* scsi_flush_work(session->host); */
- 
- 	spin_lock_bh(&session->lock);
- 	kfree(conn->data);
-@@ -1752,7 +1752,7 @@ static void iscsi_start_session_recovery
- 	conn->c_stage = ISCSI_CONN_STOPPED;
- 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
- 	spin_unlock_bh(&session->lock);
--	scsi_flush_work(session->host);
-+	/* scsi_flush_work(session->host); */
- 
- 	write_lock_bh(conn->recv_lock);
- 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
diff --git a/kernel_patches/backport/2.6.9_U4/add_iscsi_session_wq.patch b/kernel_patches/backport/2.6.9_U4/add_iscsi_session_wq.patch
new file mode 100644
index 0000000..877952f
--- /dev/null
+++ b/kernel_patches/backport/2.6.9_U4/add_iscsi_session_wq.patch
@@ -0,0 +1,135 @@
+diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
+index 9ea5b9a..751b963 100644
+--- a/drivers/infiniband/ulp/iser/iser_initiator.c
++++ b/drivers/infiniband/ulp/iser/iser_initiator.c
+@@ -612,7 +612,7 @@ void iser_snd_completion(struct iser_desc *tx_desc)
+ 
+ 	if (resume_tx) {
+ 		iser_dbg("%ld resuming tx\n",jiffies);
+-		scsi_queue_work(conn->session->host, &conn->xmitwork);
++		queue_work(conn->session->wq, &conn->xmitwork);
+ 	}
+ 
+ 	if (tx_desc->type == ISCSI_TX_CONTROL) {
+diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
+index a21455d..7f9eb42 100644
+--- a/drivers/scsi/iscsi_tcp.c
++++ b/drivers/scsi/iscsi_tcp.c
+@@ -415,7 +415,7 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
+ 	tcp_ctask->xmstate |= XMSTATE_SOL_HDR_INIT;
+ 	list_move_tail(&ctask->running, &conn->xmitqueue);
+ 
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	conn->r2t_pdus_cnt++;
+ 	spin_unlock(&session->lock);
+ 
+@@ -1044,7 +1044,7 @@ iscsi_write_space(struct sock *sk)
+ 
+ 	tcp_conn->old_write_space(sk);
+ 	debug_tcp("iscsi_write_space: cid %d\n", conn->id);
+-	scsi_queue_work(conn->session->host, &conn->xmitwork);
++	queue_work(conn->session->wq, &conn->xmitwork);
+ }
+ 
+ static void
+diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
+index 5606d1e..1611caf 100644
+--- a/drivers/scsi/libiscsi.c
++++ b/drivers/scsi/libiscsi.c
+@@ -87,8 +87,7 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)
+ 		 */
+ 		if (!list_empty(&session->leadconn->xmitqueue) ||
+ 		    __kfifo_len(session->leadconn->mgmtqueue))
+-			scsi_queue_work(session->host,
+-					&session->leadconn->xmitwork);
++			queue_work(session->wq, &session->leadconn->xmitwork);
+ 	}
+ }
+ EXPORT_SYMBOL_GPL(iscsi_update_cmdsn);
+@@ -863,7 +862,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
+ 	list_add_tail(&ctask->running, &conn->xmitqueue);
+ 	spin_unlock(&session->lock);
+ 
+-	scsi_queue_work(host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	return 0;
+ 
+ reject:
+@@ -942,7 +941,7 @@ int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr,
+ 	if (!__iscsi_conn_send_pdu(conn, hdr, data, data_size))
+ 		err = -EPERM;
+ 	spin_unlock_bh(&session->lock);
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	return err;
+ }
+ EXPORT_SYMBOL_GPL(iscsi_conn_send_pdu);
+@@ -1066,7 +1065,7 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc,
+ 		debug_scsi("abort set timeout [itt 0x%x]\n", ctask->itt);
+ 	}
+ 	spin_unlock_bh(&session->lock);
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 
+ 	/*
+ 	 * block eh thread until:
+@@ -1231,7 +1230,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
+ 		 * make sure xmit thread is not still touching the
+ 		 * ctask/scsi_cmnd
+ 		 */
+-		scsi_flush_work(session->host);
++		flush_workqueue(session->wq);
+ 		goto success_unlocked;
+ 	case TMABORT_NOT_FOUND:
+ 		if (!ctask->sc) {
+@@ -1439,6 +1438,9 @@ iscsi_session_setup(struct iscsi_transport *iscsit,
+ 		INIT_LIST_HEAD(&mtask->running);
+ 	}
+ 
++	session->wq = create_singlethread_workqueue("");
++	BUG_ON(!session->wq);
++
+ 	if (scsi_add_host(shost, NULL))
+ 		goto add_host_fail;
+ 
+@@ -1494,6 +1496,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
+ 	kfree(session->hwaddress);
+ 	kfree(session->initiatorname);
+ 
++	destroy_workqueue(session->wq);
++
+ 	iscsi_destroy_session(cls_session);
+ 	scsi_host_put(shost);
+ 	module_put(owner);
+@@ -1615,7 +1619,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
+ 	}
+ 
+ 	/* flush queued up work because we free the connection below */
+-	scsi_flush_work(session->host);
++	flush_workqueue(session->wq);
+ 
+ 	spin_lock_bh(&session->lock);
+ 	kfree(conn->data);
+@@ -1757,7 +1761,7 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
+ 	conn->c_stage = ISCSI_CONN_STOPPED;
+ 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
+ 	spin_unlock_bh(&session->lock);
+-	scsi_flush_work(session->host);
++	flush_workqueue(session->wq);
+ 
+ 	write_lock_bh(conn->recv_lock);
+ 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
+diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
+index 007d442..7856b2f 100644
+--- a/include/scsi/libiscsi.h
++++ b/include/scsi/libiscsi.h
+@@ -253,6 +253,8 @@ struct iscsi_session {
+ 	int			mgmtpool_max;	/* size of mgmt array */
+ 	struct iscsi_mgmt_task	**mgmt_cmds;	/* Original mgmt arr */
+ 	struct iscsi_queue	mgmtpool;	/* Mgmt PDU's pool */
++	struct workqueue_struct	*wq;		/* workqueue to replace the scsi *
++						 * workqueue in old kernels      */
+ };
+ 
+ /*
diff --git a/kernel_patches/backport/2.6.9_U4/libiscsi_no_flush_to_2_6_9.patch b/kernel_patches/backport/2.6.9_U4/libiscsi_no_flush_to_2_6_9.patch
deleted file mode 100644
index f9b52bd..0000000
--- a/kernel_patches/backport/2.6.9_U4/libiscsi_no_flush_to_2_6_9.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Index: ofed_kernel/drivers/scsi/libiscsi.c
-===================================================================
---- ofed_kernel.orig/drivers/scsi/libiscsi.c	2007-07-25 14:10:53.000000000 +0300
-+++ ofed_kernel/drivers/scsi/libiscsi.c	2007-07-25 14:11:40.000000000 +0300
-@@ -1225,7 +1225,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
- 		 * make sure xmit thread is not still touching the
- 		 * ctask/scsi_cmnd
- 		 */
--		scsi_flush_work(session->host);
-+		/* scsi_flush_work(session->host); */
- 		goto success_unlocked;
- 	case TMABORT_NOT_FOUND:
- 		if (!ctask->sc) {
-@@ -1608,7 +1608,7 @@ void iscsi_conn_teardown(struct iscsi_cl
- 	}
- 
- 	/* flush queued up work because we free the connection below */
--	scsi_flush_work(session->host);
-+	/* scsi_flush_work(session->host); */
- 
- 	spin_lock_bh(&session->lock);
- 	kfree(conn->data);
-@@ -1752,7 +1752,7 @@ static void iscsi_start_session_recovery
- 	conn->c_stage = ISCSI_CONN_STOPPED;
- 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
- 	spin_unlock_bh(&session->lock);
--	scsi_flush_work(session->host);
-+	/* scsi_flush_work(session->host); */
- 
- 	write_lock_bh(conn->recv_lock);
- 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
diff --git a/kernel_patches/backport/2.6.9_U5/add_iscsi_session_wq.patch b/kernel_patches/backport/2.6.9_U5/add_iscsi_session_wq.patch
new file mode 100644
index 0000000..877952f
--- /dev/null
+++ b/kernel_patches/backport/2.6.9_U5/add_iscsi_session_wq.patch
@@ -0,0 +1,135 @@
+diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
+index 9ea5b9a..751b963 100644
+--- a/drivers/infiniband/ulp/iser/iser_initiator.c
++++ b/drivers/infiniband/ulp/iser/iser_initiator.c
+@@ -612,7 +612,7 @@ void iser_snd_completion(struct iser_desc *tx_desc)
+ 
+ 	if (resume_tx) {
+ 		iser_dbg("%ld resuming tx\n",jiffies);
+-		scsi_queue_work(conn->session->host, &conn->xmitwork);
++		queue_work(conn->session->wq, &conn->xmitwork);
+ 	}
+ 
+ 	if (tx_desc->type == ISCSI_TX_CONTROL) {
+diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
+index a21455d..7f9eb42 100644
+--- a/drivers/scsi/iscsi_tcp.c
++++ b/drivers/scsi/iscsi_tcp.c
+@@ -415,7 +415,7 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
+ 	tcp_ctask->xmstate |= XMSTATE_SOL_HDR_INIT;
+ 	list_move_tail(&ctask->running, &conn->xmitqueue);
+ 
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	conn->r2t_pdus_cnt++;
+ 	spin_unlock(&session->lock);
+ 
+@@ -1044,7 +1044,7 @@ iscsi_write_space(struct sock *sk)
+ 
+ 	tcp_conn->old_write_space(sk);
+ 	debug_tcp("iscsi_write_space: cid %d\n", conn->id);
+-	scsi_queue_work(conn->session->host, &conn->xmitwork);
++	queue_work(conn->session->wq, &conn->xmitwork);
+ }
+ 
+ static void
+diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
+index 5606d1e..1611caf 100644
+--- a/drivers/scsi/libiscsi.c
++++ b/drivers/scsi/libiscsi.c
+@@ -87,8 +87,7 @@ iscsi_update_cmdsn(struct iscsi_session *session, struct iscsi_nopin *hdr)
+ 		 */
+ 		if (!list_empty(&session->leadconn->xmitqueue) ||
+ 		    __kfifo_len(session->leadconn->mgmtqueue))
+-			scsi_queue_work(session->host,
+-					&session->leadconn->xmitwork);
++			queue_work(session->wq, &session->leadconn->xmitwork);
+ 	}
+ }
+ EXPORT_SYMBOL_GPL(iscsi_update_cmdsn);
+@@ -863,7 +862,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
+ 	list_add_tail(&ctask->running, &conn->xmitqueue);
+ 	spin_unlock(&session->lock);
+ 
+-	scsi_queue_work(host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	return 0;
+ 
+ reject:
+@@ -942,7 +941,7 @@ int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr,
+ 	if (!__iscsi_conn_send_pdu(conn, hdr, data, data_size))
+ 		err = -EPERM;
+ 	spin_unlock_bh(&session->lock);
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 	return err;
+ }
+ EXPORT_SYMBOL_GPL(iscsi_conn_send_pdu);
+@@ -1066,7 +1065,7 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc,
+ 		debug_scsi("abort set timeout [itt 0x%x]\n", ctask->itt);
+ 	}
+ 	spin_unlock_bh(&session->lock);
+-	scsi_queue_work(session->host, &conn->xmitwork);
++	queue_work(session->wq, &conn->xmitwork);
+ 
+ 	/*
+ 	 * block eh thread until:
+@@ -1231,7 +1230,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
+ 		 * make sure xmit thread is not still touching the
+ 		 * ctask/scsi_cmnd
+ 		 */
+-		scsi_flush_work(session->host);
++		flush_workqueue(session->wq);
+ 		goto success_unlocked;
+ 	case TMABORT_NOT_FOUND:
+ 		if (!ctask->sc) {
+@@ -1439,6 +1438,9 @@ iscsi_session_setup(struct iscsi_transport *iscsit,
+ 		INIT_LIST_HEAD(&mtask->running);
+ 	}
+ 
++	session->wq = create_singlethread_workqueue("");
++	BUG_ON(!session->wq);
++
+ 	if (scsi_add_host(shost, NULL))
+ 		goto add_host_fail;
+ 
+@@ -1494,6 +1496,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
+ 	kfree(session->hwaddress);
+ 	kfree(session->initiatorname);
+ 
++	destroy_workqueue(session->wq);
++
+ 	iscsi_destroy_session(cls_session);
+ 	scsi_host_put(shost);
+ 	module_put(owner);
+@@ -1615,7 +1619,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
+ 	}
+ 
+ 	/* flush queued up work because we free the connection below */
+-	scsi_flush_work(session->host);
++	flush_workqueue(session->wq);
+ 
+ 	spin_lock_bh(&session->lock);
+ 	kfree(conn->data);
+@@ -1757,7 +1761,7 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
+ 	conn->c_stage = ISCSI_CONN_STOPPED;
+ 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
+ 	spin_unlock_bh(&session->lock);
+-	scsi_flush_work(session->host);
++	flush_workqueue(session->wq);
+ 
+ 	write_lock_bh(conn->recv_lock);
+ 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
+diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
+index 007d442..7856b2f 100644
+--- a/include/scsi/libiscsi.h
++++ b/include/scsi/libiscsi.h
+@@ -253,6 +253,8 @@ struct iscsi_session {
+ 	int			mgmtpool_max;	/* size of mgmt array */
+ 	struct iscsi_mgmt_task	**mgmt_cmds;	/* Original mgmt arr */
+ 	struct iscsi_queue	mgmtpool;	/* Mgmt PDU's pool */
++	struct workqueue_struct	*wq;		/* workqueue to replace the scsi *
++						 * workqueue in old kernels      */
+ };
+ 
+ /*
diff --git a/kernel_patches/backport/2.6.9_U5/libiscsi_no_flush_to_2_6_9.patch b/kernel_patches/backport/2.6.9_U5/libiscsi_no_flush_to_2_6_9.patch
deleted file mode 100644
index f9b52bd..0000000
--- a/kernel_patches/backport/2.6.9_U5/libiscsi_no_flush_to_2_6_9.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Index: ofed_kernel/drivers/scsi/libiscsi.c
-===================================================================
---- ofed_kernel.orig/drivers/scsi/libiscsi.c	2007-07-25 14:10:53.000000000 +0300
-+++ ofed_kernel/drivers/scsi/libiscsi.c	2007-07-25 14:11:40.000000000 +0300
-@@ -1225,7 +1225,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
- 		 * make sure xmit thread is not still touching the
- 		 * ctask/scsi_cmnd
- 		 */
--		scsi_flush_work(session->host);
-+		/* scsi_flush_work(session->host); */
- 		goto success_unlocked;
- 	case TMABORT_NOT_FOUND:
- 		if (!ctask->sc) {
-@@ -1608,7 +1608,7 @@ void iscsi_conn_teardown(struct iscsi_cl
- 	}
- 
- 	/* flush queued up work because we free the connection below */
--	scsi_flush_work(session->host);
-+	/* scsi_flush_work(session->host); */
- 
- 	spin_lock_bh(&session->lock);
- 	kfree(conn->data);
-@@ -1752,7 +1752,7 @@ static void iscsi_start_session_recovery
- 	conn->c_stage = ISCSI_CONN_STOPPED;
- 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
- 	spin_unlock_bh(&session->lock);
--	scsi_flush_work(session->host);
-+	/* scsi_flush_work(session->host); */
- 
- 	write_lock_bh(conn->recv_lock);
- 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
-- 
1.5.3





More information about the ewg mailing list