aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2011-11-22 16:51:32 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2011-12-06 01:00:55 -0500
commit410f670202f0f13cdac8459b9c3effeeead135d1 (patch)
treedfad1b29759c54f4ce5141f6d15b8f3d18d00b6e /drivers/target
parent1c3d5794fc4a2afd2258b3aa6406377934a36663 (diff)
target: Don't return an error status for 0-length READ and WRITE
IO commands with a TRANSFER LENGTH of 0 are not an error; for example, for READ (10) and WRITE (10), SBC-3 says: A TRANSFER LENGTH field set to zero specifies that no logical blocks shall be read. This condition shall not be considered an error. In case we have nothing to do, just complete the command with good status. Signed-off-by: Roland Dreier <roland@purestorage.com> Cc: stable@kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_transport.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 0bdb6badbf99..1b760a0b1109 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3770,8 +3770,15 @@ int transport_generic_new_cmd(struct se_cmd *cmd)
3770 task_cdbs = transport_allocate_control_task(cmd); 3770 task_cdbs = transport_allocate_control_task(cmd);
3771 } 3771 }
3772 3772
3773 if (task_cdbs <= 0) 3773 if (task_cdbs < 0)
3774 goto out_fail; 3774 goto out_fail;
3775 else if (!task_cdbs && (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) {
3776 cmd->t_state = TRANSPORT_COMPLETE;
3777 atomic_set(&cmd->t_transport_active, 1);
3778 INIT_WORK(&cmd->work, target_complete_ok_work);
3779 queue_work(target_completion_wq, &cmd->work);
3780 return 0;
3781 }
3775 3782
3776 if (set_counts) { 3783 if (set_counts) {
3777 atomic_inc(&cmd->t_fe_count); 3784 atomic_inc(&cmd->t_fe_count);