[SCSI] libiscsi: have iscsi_data_in_rsp call iscsi_update_cmdsn
[linux-2.6.git] / drivers / scsi / libiscsi_tcp.c
index 91f8ce4..db93cd0 100644 (file)
@@ -473,7 +473,13 @@ static int iscsi_tcp_data_in(struct iscsi_conn *conn, struct iscsi_task *task)
        int datasn = be32_to_cpu(rhdr->datasn);
        unsigned total_in_length = scsi_in(task->sc)->length;
 
-       iscsi_update_cmdsn(conn->session, (struct iscsi_nopin*)rhdr);
+       /*
+        * lib iscsi will update this in the completion handling if there
+        * is status.
+        */
+       if (!(rhdr->flags & ISCSI_FLAG_DATA_STATUS))
+               iscsi_update_cmdsn(conn->session, (struct iscsi_nopin*)rhdr);
+
        if (tcp_conn->in.datalen == 0)
                return 0;
 
@@ -1036,8 +1042,11 @@ flush:
 
        rc = conn->session->tt->init_pdu(task, r2t->data_offset + r2t->sent,
                                         r2t->data_count);
-       if (rc)
+       if (rc) {
+               iscsi_conn_failure(conn, ISCSI_ERR_XMIT_FAILED);
                return rc;
+       }
+
        r2t->sent += r2t->data_count;
        goto flush;
 }