When fast_abort is not set we have to send out all outstanding
Data-out PDUs. However, the loop in iscsi_data_xmit() will be
terminated at the first PDU for which check_tmf_restrictions()
returns non-zero, causing all other PDUs in the queue to be
not checked. So we should traverse all queue entries here
to catch all outstanding Data-out PDUs.

Signed-off-by: Hannes Reinecke <[email protected]>
---
 drivers/scsi/libiscsi.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index fd34347..a0d1217 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1415,7 +1415,7 @@ EXPORT_SYMBOL_GPL(iscsi_requeue_task);
  **/
 static int iscsi_data_xmit(struct iscsi_conn *conn)
 {
-       struct iscsi_task *task;
+       struct iscsi_task *task, *tmptask;
        int rc = 0;
 
        spin_lock_bh(&conn->session->lock);
@@ -1466,7 +1466,10 @@ check_mgmt:
                                list_add_tail(&conn->task->running,
                                              &conn->cmdqueue);
                                conn->task = NULL;
-                               goto done;
+                               if (rc == -ENOMEM)
+                                       goto done;
+                               else
+                                       break;
                        } else
                                fail_scsi_task(conn->task, DID_ABORT);
                        continue;
@@ -1483,17 +1486,15 @@ check_mgmt:
                        goto check_mgmt;
        }
 
-       while (!list_empty(&conn->requeue)) {
+       list_for_each_entry_safe(task, tmptask, &conn->requeue, running) {
                /*
                 * we always do fastlogout - conn stop code will clean up.
                 */
                if (conn->session->state == ISCSI_STATE_LOGGING_OUT)
                        break;
 
-               task = list_entry(conn->requeue.next, struct iscsi_task,
-                                 running);
                if (iscsi_check_tmf_restrictions(task, ISCSI_OP_SCSI_DATA_OUT))
-                       break;
+                       continue;
 
                conn->task = task;
                list_del_init(&conn->task->running);
-- 
1.6.0.2


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

Reply via email to