When sending a PDU we're just increase the CmdSN number
without any check for MaxCmdSN. This results in unexpected
ping timeouts and even connection stalls.

So we should make sure to check CmdSN against MaxCmdSN
before transferring a PDU, and just retry until MaxCmdSN
has been updated.

Signed-off-by: Hannes Reinecke <h...@suse.de>
---
 drivers/scsi/libiscsi.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 21ed45f..ffb1338 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1273,6 +1273,19 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
                        goto again;
        }
 
+       if (conn->session->state == ISCSI_STATE_LOGGED_IN &&
+           !iscsi_sna_lte(conn->session->cmdsn,
+                          conn->session->max_cmdsn)) {
+               /* Window closed, wait for MaxCmdSN update */
+               ISCSI_DBG_SESSION(conn->session,
+                                 "target window closed, "
+                                 "cmd %u max %u\n",
+                                 conn->session->cmdsn,
+                                 conn->session->max_cmdsn);
+               spin_unlock_bh(&conn->session->lock);
+               return -ENODATA;
+       }
+
        /*
         * process mgmt pdus like nops before commands since we should
         * only have one nop-out as a ping from us and targets should not
-- 
1.5.3.2


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

Reply via email to