diff options
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 010c1b9b178c..b43bf1d60dac 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -730,7 +730,9 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
730 | if (iscsi_recv_pdu(conn->cls_conn, hdr, data, | 730 | if (iscsi_recv_pdu(conn->cls_conn, hdr, data, |
731 | datalen)) | 731 | datalen)) |
732 | rc = ISCSI_ERR_CONN_FAILED; | 732 | rc = ISCSI_ERR_CONN_FAILED; |
733 | } | 733 | } else |
734 | mod_timer(&conn->transport_timer, | ||
735 | jiffies + conn->recv_timeout); | ||
734 | iscsi_free_mgmt_task(conn, mtask); | 736 | iscsi_free_mgmt_task(conn, mtask); |
735 | break; | 737 | break; |
736 | default: | 738 | default: |
@@ -1453,19 +1455,20 @@ static void iscsi_check_transport_timeouts(unsigned long data) | |||
1453 | { | 1455 | { |
1454 | struct iscsi_conn *conn = (struct iscsi_conn *)data; | 1456 | struct iscsi_conn *conn = (struct iscsi_conn *)data; |
1455 | struct iscsi_session *session = conn->session; | 1457 | struct iscsi_session *session = conn->session; |
1456 | unsigned long timeout, next_timeout = 0, last_recv; | 1458 | unsigned long recv_timeout, next_timeout = 0, last_recv; |
1457 | 1459 | ||
1458 | spin_lock(&session->lock); | 1460 | spin_lock(&session->lock); |
1459 | if (session->state != ISCSI_STATE_LOGGED_IN) | 1461 | if (session->state != ISCSI_STATE_LOGGED_IN) |
1460 | goto done; | 1462 | goto done; |
1461 | 1463 | ||
1462 | timeout = conn->recv_timeout; | 1464 | recv_timeout = conn->recv_timeout; |
1463 | if (!timeout) | 1465 | if (!recv_timeout) |
1464 | goto done; | 1466 | goto done; |
1465 | 1467 | ||
1466 | timeout *= HZ; | 1468 | recv_timeout *= HZ; |
1467 | last_recv = conn->last_recv; | 1469 | last_recv = conn->last_recv; |
1468 | if (time_before_eq(last_recv + timeout + (conn->ping_timeout * HZ), | 1470 | if (conn->ping_mtask && |
1471 | time_before_eq(conn->last_ping + (conn->ping_timeout * HZ), | ||
1469 | jiffies)) { | 1472 | jiffies)) { |
1470 | iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs " | 1473 | iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs " |
1471 | "expired, last rx %lu, last ping %lu, " | 1474 | "expired, last rx %lu, last ping %lu, " |
@@ -1476,15 +1479,13 @@ static void iscsi_check_transport_timeouts(unsigned long data) | |||
1476 | return; | 1479 | return; |
1477 | } | 1480 | } |
1478 | 1481 | ||
1479 | if (time_before_eq(last_recv + timeout, jiffies)) { | 1482 | if (time_before_eq(last_recv + recv_timeout, jiffies)) { |
1480 | if (time_before_eq(conn->last_ping, last_recv)) { | 1483 | /* send a ping to try to provoke some traffic */ |
1481 | /* send a ping to try to provoke some traffic */ | 1484 | debug_scsi("Sending nopout as ping on conn %p\n", conn); |
1482 | debug_scsi("Sending nopout as ping on conn %p\n", conn); | 1485 | iscsi_send_nopout(conn, NULL); |
1483 | iscsi_send_nopout(conn, NULL); | 1486 | next_timeout = conn->last_ping + (conn->ping_timeout * HZ); |
1484 | } | ||
1485 | next_timeout = last_recv + timeout + (conn->ping_timeout * HZ); | ||
1486 | } else | 1487 | } else |
1487 | next_timeout = last_recv + timeout; | 1488 | next_timeout = last_recv + recv_timeout; |
1488 | 1489 | ||
1489 | debug_scsi("Setting next tmo %lu\n", next_timeout); | 1490 | debug_scsi("Setting next tmo %lu\n", next_timeout); |
1490 | mod_timer(&conn->transport_timer, next_timeout); | 1491 | mod_timer(&conn->transport_timer, next_timeout); |