Blob Blame History Raw
From 1f7fd558c4da3c92bdae67646504eaec16e6081f Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Thu, 12 Feb 2015 16:01:48 -0800
Subject: [PATCH] honor all requested delays in iscsi_sched_ev_context

The session_conn_uio_poll function reschedules itself in the same was as
session_conn_poll, by calling iscsi_sched_ev_context with a delay.  That
delay needs to not be ignored.

Actually, most all of the cases in iscsi_sched_ev_context can use
actor_timer to ensure any passed delay argument is honored (even if most
of them are passed as 0).

Signed-off-by: Chris Leech <cleech@redhat.com>
---
 usr/initiator.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/usr/initiator.c b/usr/initiator.c
index 3b39c5d..93a3c27 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1800,9 +1800,8 @@ static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
 	ev_context->conn = conn;
 	switch (event) {
 	case EV_CONN_RECV_PDU:
-		actor_init(&ev_context->actor, session_conn_recv_pdu,
-			  ev_context);
-		actor_schedule(&ev_context->actor);
+		actor_timer(&ev_context->actor, tmo,
+			    session_conn_recv_pdu, ev_context);
 		break;
 	case EV_CONN_ERROR:
 		error = *(enum iscsi_err *)ev_context->data;
@@ -1820,27 +1819,24 @@ static int iscsi_sched_ev_context(struct iscsi_ev_context *ev_context,
 			actor_schedule(&ev_context->actor);
 		break;
 	case EV_CONN_LOGIN:
-		actor_init(&ev_context->actor, session_conn_process_login,
-			  ev_context);
-		actor_schedule(&ev_context->actor);
+		actor_timer(&ev_context->actor, tmo,
+			    session_conn_process_login, ev_context);
 		break;
 	case EV_CONN_POLL:
 		actor_timer(&ev_context->actor, tmo,
 			    session_conn_poll, ev_context);
 		break;
 	case EV_UIO_POLL:
-		actor_init(&ev_context->actor, session_conn_uio_poll,
-			  ev_context);
-		actor_schedule(&ev_context->actor);
+		actor_timer(&ev_context->actor, tmo,
+			    session_conn_uio_poll, ev_context);
 		break;
 	case EV_CONN_LOGOUT_TIMER:
 		actor_timer(&ev_context->actor, tmo,
 			    iscsi_logout_timedout, ev_context);
 		break;
 	case EV_CONN_STOP:
-		actor_init(&ev_context->actor, iscsi_stop,
-			  ev_context);
-		actor_schedule(&ev_context->actor);
+		actor_timer(&ev_context->actor, tmo,
+			    iscsi_stop, ev_context);
 		break;
 	default:
 		log_error("Invalid event type %d.", event);
-- 
2.1.0