Mike Christie wrote:
> Mike Christie wrote:
>> Mike Christie wrote:
>>> Mike Christie wrote:
>>>> On 07/31/2009 07:43 AM, Erez Zilber wrote:
>>>>> I thought that this patch just reduces the timeout from 15 to 3. Does
>>>>> it also fix the 3 sndtmo periods or is it another patch? What was the
>>>> Another patch. You should have it.
>>>>
>>>>> bug that caused the 3 sndtmo periods waiting?
>>>>>
>>>> I think I meant two.
>>>>
>>>> If iscsi_tcp_xmit_segment sent some data, then got EAGIN, it would drop 
>>>> the EAGIN. iscsi_xmit would then retry the operation so we would wait 
>>>> again.
>>>>
>>> There is one more bug.
>>>
>>> Could you try the 15->3 sec snd tmp patch plus the attached patch?
>>>
>>> Another problem is that if we had multiple tasks on the cmd or requeue 
>>> lists, and iscsi_tcp returns a error, the write_space function can still 
>>> run and queue iscsi_data_xmit. If it was a legetimate problem and 
>>> iscsi_conn_failure was run but we raced and iscsi_data_xmit was run 
>>> first it could miss the suspend bit checks, and start trying to send 
>>> data again and hit another timeout.
>>>
>> Here is a updated patch that also fixes the problem for cxgb3i and 
>> iscsi_tcp.
>>
> 
> Sorry. This one fixes a possible leak.
> 

And here is a patch to signal the xmit thread. I am not sure what I was 
doing wrong before. For some reason the thread would not break out of 
the wait. With this patch it is working. It is built over the 
check-suspend2.patch.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index a8e5089..b508468 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -304,7 +304,7 @@ static int iscsi_sw_tcp_xmit(struct iscsi_conn *conn)
 		 * is getting stopped. libiscsi will know so propogate err
 		 * for it to do the right thing.
 		 */
-		if (rc == -EAGAIN)
+		if (rc == -EAGAIN || rc == -EINTR || rc == -ENODATA)
 			return rc;
 		else if (rc < 0) {
 			rc = ISCSI_ERR_XMIT_FAILED;
@@ -508,6 +508,24 @@ static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
 	return 0;
 }
 
+static void __iscsi_sw_tcp_prep_xmit_wq(struct work_struct *work)
+{
+	struct iscsi_sw_tcp_conn *tcp_sw_conn =
+			container_of(work, struct iscsi_sw_tcp_conn, prep_work);
+
+	allow_signal(SIGUSR1);
+	set_user_nice(current, -20);
+	tcp_sw_conn->xmit_task = current;
+}
+
+static void iscsi_sw_tcp_prep_xmit_wq(struct iscsi_host *ihost,
+				     struct iscsi_sw_tcp_conn *tcp_sw_conn)
+{
+	INIT_WORK(&tcp_sw_conn->prep_work, __iscsi_sw_tcp_prep_xmit_wq);
+	queue_work(ihost->workq, &tcp_sw_conn->prep_work);
+	flush_workqueue(ihost->workq);
+}
+
 static struct iscsi_cls_conn *
 iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session,
 			 uint32_t conn_idx)
@@ -538,6 +556,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session,
 		goto free_tx_tfm;
 	tcp_conn->rx_hash = &tcp_sw_conn->rx_hash;
 
+	iscsi_sw_tcp_prep_xmit_wq(shost_priv(conn->session->host),
+				  tcp_sw_conn);
 	return cls_conn;
 
 free_tx_tfm:
@@ -606,6 +626,10 @@ static void iscsi_sw_tcp_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
 	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
 	write_unlock_bh(&tcp_sw_conn->sock->sk->sk_callback_lock);
 
+	set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
+	if (tcp_sw_conn->xmit_task)
+		send_sig(SIGUSR1, tcp_sw_conn->xmit_task, 0);
+
 	iscsi_conn_stop(cls_conn, flag);
 	iscsi_sw_tcp_release_conn(conn);
 }
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index ca6b7bc..cec3d4c 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -36,8 +36,9 @@ struct iscsi_sw_tcp_send {
 };
 
 struct iscsi_sw_tcp_conn {
-	struct iscsi_conn	*iscsi_conn;
 	struct socket		*sock;
+	struct task_struct	*xmit_task;
+	struct work_struct	prep_work;
 
 	struct iscsi_sw_tcp_send out;
 	/* old values for socket callbacks */
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index a7ee4bb..ef08f10 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1436,6 +1436,9 @@ static void iscsi_xmitworker(struct work_struct *work)
 	 * serialize Xmit worker on a per-connection basis.
 	 */
 	do {
+		if (signal_pending(current))
+			flush_signals(current);
+
 		rc = iscsi_data_xmit(conn);
 	} while (rc >= 0 || rc == -EAGAIN);
 }

Reply via email to