Commit 4c48a829 authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[SCSI] libiscsi: fix iscsi transport checks to account for slower links

If we have not got any pdus for recv_timeout seconds, then we will
send a iscsi ping/nop to make sure the target is still around. The
problem is if this is a slow link, and the ping got queued after
the data for a data_out (read), then the transport code could think
the ping has failed when it is just slowly making its way through
the network. This patch has us check if we are making progress while
the nop is outstanding. If we are still reading in data, then we
do not fail the session at that time.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent d1acfae5
...@@ -1677,6 +1677,22 @@ static void iscsi_start_tx(struct iscsi_conn *conn) ...@@ -1677,6 +1677,22 @@ static void iscsi_start_tx(struct iscsi_conn *conn)
iscsi_conn_queue_work(conn); iscsi_conn_queue_work(conn);
} }
/*
* We want to make sure a ping is in flight. It has timed out.
* And we are not busy processing a pdu that is making
* progress but got started before the ping and is taking a while
* to complete so the ping is just stuck behind it in a queue.
*/
static int iscsi_has_ping_timed_out(struct iscsi_conn *conn)
{
if (conn->ping_task &&
time_before_eq(conn->last_recv + (conn->recv_timeout * HZ) +
(conn->ping_timeout * HZ), jiffies))
return 1;
else
return 0;
}
static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *scmd) static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *scmd)
{ {
struct iscsi_cls_session *cls_session; struct iscsi_cls_session *cls_session;
...@@ -1712,16 +1728,20 @@ static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *scmd) ...@@ -1712,16 +1728,20 @@ static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *scmd)
* if the ping timedout then we are in the middle of cleaning up * if the ping timedout then we are in the middle of cleaning up
* and can let the iscsi eh handle it * and can let the iscsi eh handle it
*/ */
if (time_before_eq(conn->last_recv + (conn->recv_timeout * HZ) + if (iscsi_has_ping_timed_out(conn)) {
(conn->ping_timeout * HZ), jiffies))
rc = BLK_EH_RESET_TIMER; rc = BLK_EH_RESET_TIMER;
goto done;
}
/* /*
* if we are about to check the transport then give the command * if we are about to check the transport then give the command
* more time * more time
*/ */
if (time_before_eq(conn->last_recv + (conn->recv_timeout * HZ), if (time_before_eq(conn->last_recv + (conn->recv_timeout * HZ),
jiffies)) jiffies)) {
rc = BLK_EH_RESET_TIMER; rc = BLK_EH_RESET_TIMER;
goto done;
}
/* if in the middle of checking the transport then give us more time */ /* if in the middle of checking the transport then give us more time */
if (conn->ping_task) if (conn->ping_task)
rc = BLK_EH_RESET_TIMER; rc = BLK_EH_RESET_TIMER;
...@@ -1748,13 +1768,13 @@ static void iscsi_check_transport_timeouts(unsigned long data) ...@@ -1748,13 +1768,13 @@ static void iscsi_check_transport_timeouts(unsigned long data)
recv_timeout *= HZ; recv_timeout *= HZ;
last_recv = conn->last_recv; last_recv = conn->last_recv;
if (conn->ping_task &&
time_before_eq(conn->last_ping + (conn->ping_timeout * HZ), if (iscsi_has_ping_timed_out(conn)) {
jiffies)) {
iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs " iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs "
"expired, last rx %lu, last ping %lu, " "expired, recv timeout %d, last rx %lu, "
"now %lu\n", conn->ping_timeout, last_recv, "last ping %lu, now %lu\n",
conn->last_ping, jiffies); conn->ping_timeout, conn->recv_timeout,
last_recv, conn->last_ping, jiffies);
spin_unlock(&session->lock); spin_unlock(&session->lock);
iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment