summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-05-05 21:45:13 -0500
committerMike Christie <michaelc@cs.wisc.edu>2008-05-05 21:48:26 -0500
commit611c947adce93727c6864413f5159b964326837f (patch)
treec3619da37ea68a7fb015409c475d90b5a86bc713
parentad5a2741457b41ee2005401ffc4aae49d0fb9cbb (diff)
downloadopen-iscsi-611c947adce93727c6864413f5159b964326837f.tar.gz
libiscsi: Fix nop timeout handling
If the transport timer wakes at the exact same time we were supposed to check the transport we drop the connection instead of checking it.
-rw-r--r--Changelog3
-rw-r--r--kernel/libiscsi.c17
2 files changed, 12 insertions, 8 deletions
diff --git a/Changelog b/Changelog
new file mode 100644
index 0000000..b6e3087
--- /dev/null
+++ b/Changelog
@@ -0,0 +1,3 @@
+open-iscsi-2.0-869.1
+- Fix nop out timer. If the timer wakes up at the exact same time we were
+supposed to check the transport we mistakenly drop the connection.
diff --git a/kernel/libiscsi.c b/kernel/libiscsi.c
index 30ea61a..ed37f1b 100644
--- a/kernel/libiscsi.c
+++ b/kernel/libiscsi.c
@@ -1353,19 +1353,20 @@ static void iscsi_check_transport_timeouts(unsigned long data)
{
struct iscsi_conn *conn = (struct iscsi_conn *)data;
struct iscsi_session *session = conn->session;
- unsigned long timeout, next_timeout = 0, last_recv;
+ unsigned long recv_timeout, next_timeout = 0, last_recv;
spin_lock(&session->lock);
if (session->state != ISCSI_STATE_LOGGED_IN)
goto done;
- timeout = conn->recv_timeout;
- if (!timeout)
+ recv_timeout = conn->recv_timeout;
+ if (!recv_timeout)
goto done;
- timeout *= HZ;
+ recv_timeout *= HZ;
last_recv = conn->last_recv;
- if (time_before_eq(last_recv + timeout + (conn->ping_timeout * HZ),
+ if (conn->ping_mtask &&
+ time_before_eq(conn->last_ping + (conn->ping_timeout * HZ),
jiffies)) {
iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs "
"expired, last rx %lu, last ping %lu, "
@@ -1376,15 +1377,15 @@ static void iscsi_check_transport_timeouts(unsigned long data)
return;
}
- if (time_before_eq(last_recv + timeout, jiffies)) {
+ if (time_before_eq(last_recv + recv_timeout, jiffies)) {
if (time_before_eq(conn->last_ping, last_recv)) {
/* send a ping to try to provoke some traffic */
debug_scsi("Sending nopout as ping on conn %p\n", conn);
iscsi_send_nopout(conn, NULL);
}
- next_timeout = last_recv + timeout + (conn->ping_timeout * HZ);
+ next_timeout = conn->last_ping + (conn->ping_timeout * HZ);
} else
- next_timeout = last_recv + timeout;
+ next_timeout = last_recv + recv_timeout;
debug_scsi("Setting next tmo %lu\n", next_timeout);
mod_timer(&conn->transport_timer, next_timeout);