Commit 67236c44 authored by Martin Svec's avatar Martin Svec Committed by Nicholas Bellinger

target: Fix unsupported WRITE_SAME sense payload

This patch fixes a bug in target-core where unsupported WRITE_SAME ops
from a target_check_write_same_discard() failure was incorrectly
returning CHECK_CONDITION w/ TCM_INVALID_CDB_FIELD sense data.
This was causing some clients to not properly fall back, so go ahead
and use the correct TCM_UNSUPPORTED_SCSI_OPCODE sense for this case.
Reported-by: default avatarMartin Svec <martin.svec@zoner.cz>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 9f9ef6d3
...@@ -2697,7 +2697,7 @@ static int transport_generic_cmd_sequencer( ...@@ -2697,7 +2697,7 @@ static int transport_generic_cmd_sequencer(
cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB;
if (target_check_write_same_discard(&cdb[10], dev) < 0) if (target_check_write_same_discard(&cdb[10], dev) < 0)
goto out_invalid_cdb_field; goto out_unsupported_cdb;
if (!passthrough) if (!passthrough)
cmd->execute_task = target_emulate_write_same; cmd->execute_task = target_emulate_write_same;
break; break;
...@@ -2980,7 +2980,7 @@ static int transport_generic_cmd_sequencer( ...@@ -2980,7 +2980,7 @@ static int transport_generic_cmd_sequencer(
cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB;
if (target_check_write_same_discard(&cdb[1], dev) < 0) if (target_check_write_same_discard(&cdb[1], dev) < 0)
goto out_invalid_cdb_field; goto out_unsupported_cdb;
if (!passthrough) if (!passthrough)
cmd->execute_task = target_emulate_write_same; cmd->execute_task = target_emulate_write_same;
break; break;
...@@ -3003,7 +3003,7 @@ static int transport_generic_cmd_sequencer( ...@@ -3003,7 +3003,7 @@ static int transport_generic_cmd_sequencer(
* of byte 1 bit 3 UNMAP instead of original reserved field * of byte 1 bit 3 UNMAP instead of original reserved field
*/ */
if (target_check_write_same_discard(&cdb[1], dev) < 0) if (target_check_write_same_discard(&cdb[1], dev) < 0)
goto out_invalid_cdb_field; goto out_unsupported_cdb;
if (!passthrough) if (!passthrough)
cmd->execute_task = target_emulate_write_same; cmd->execute_task = target_emulate_write_same;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment