Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target...
[cascardo/linux.git] / drivers / scsi / qla2xxx / tcm_qla2xxx.c
index 75caa39..a318092 100644 (file)
@@ -688,8 +688,12 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
                 * For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen
                 * for qla_tgt_xmit_response LLD code
                 */
+               if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) {
+                       se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT;
+                       se_cmd->residual_count = 0;
+               }
                se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT;
-               se_cmd->residual_count = se_cmd->data_length;
+               se_cmd->residual_count += se_cmd->data_length;
 
                cmd->bufflen = 0;
        }