diff options
| -rw-r--r-- | drivers/target/target_core_transport.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 000bc6d077ea..e825d580ccee 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
| @@ -754,15 +754,7 @@ EXPORT_SYMBOL(target_complete_cmd); | |||
| 754 | 754 | ||
| 755 | void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int length) | 755 | void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int length) |
| 756 | { | 756 | { |
| 757 | if (scsi_status != SAM_STAT_GOOD) { | 757 | if (scsi_status == SAM_STAT_GOOD && length < cmd->data_length) { |
| 758 | return; | ||
| 759 | } | ||
| 760 | |||
| 761 | /* | ||
| 762 | * Calculate new residual count based upon length of SCSI data | ||
| 763 | * transferred. | ||
| 764 | */ | ||
| 765 | if (length < cmd->data_length) { | ||
| 766 | if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { | 758 | if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { |
| 767 | cmd->residual_count += cmd->data_length - length; | 759 | cmd->residual_count += cmd->data_length - length; |
| 768 | } else { | 760 | } else { |
| @@ -771,12 +763,6 @@ void target_complete_cmd_with_length(struct se_cmd *cmd, u8 scsi_status, int len | |||
| 771 | } | 763 | } |
| 772 | 764 | ||
| 773 | cmd->data_length = length; | 765 | cmd->data_length = length; |
| 774 | } else if (length > cmd->data_length) { | ||
| 775 | cmd->se_cmd_flags |= SCF_OVERFLOW_BIT; | ||
| 776 | cmd->residual_count = length - cmd->data_length; | ||
| 777 | } else { | ||
| 778 | cmd->se_cmd_flags &= ~(SCF_OVERFLOW_BIT | SCF_UNDERFLOW_BIT); | ||
| 779 | cmd->residual_count = 0; | ||
| 780 | } | 766 | } |
| 781 | 767 | ||
| 782 | target_complete_cmd(cmd, scsi_status); | 768 | target_complete_cmd(cmd, scsi_status); |
