Commit 0c2305d1 authored by Roland Dreier's avatar Roland Dreier Committed by Ben Hutchings

target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE

commit e2397c70 upstream.

Many SCSI commands are defined to return a CHECK CONDITION / ILLEGAL
REQUEST with ASC set to LOGICAL BLOCK ADDRESS OUT OF RANGE if the
initiator sends a command that accesses a too-big LBA.  Add an enum
value and case entries so that target code can return this status.
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 6e59fd8e
...@@ -1820,6 +1820,7 @@ static void transport_generic_request_failure(struct se_cmd *cmd) ...@@ -1820,6 +1820,7 @@ static void transport_generic_request_failure(struct se_cmd *cmd)
case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE: case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE:
case TCM_UNKNOWN_MODE_PAGE: case TCM_UNKNOWN_MODE_PAGE:
case TCM_WRITE_PROTECTED: case TCM_WRITE_PROTECTED:
case TCM_ADDRESS_OUT_OF_RANGE:
case TCM_CHECK_CONDITION_ABORT_CMD: case TCM_CHECK_CONDITION_ABORT_CMD:
case TCM_CHECK_CONDITION_UNIT_ATTENTION: case TCM_CHECK_CONDITION_UNIT_ATTENTION:
case TCM_CHECK_CONDITION_NOT_READY: case TCM_CHECK_CONDITION_NOT_READY:
...@@ -4496,6 +4497,15 @@ int transport_send_check_condition_and_sense( ...@@ -4496,6 +4497,15 @@ int transport_send_check_condition_and_sense(
/* WRITE PROTECTED */ /* WRITE PROTECTED */
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x27; buffer[offset+SPC_ASC_KEY_OFFSET] = 0x27;
break; break;
case TCM_ADDRESS_OUT_OF_RANGE:
/* CURRENT ERROR */
buffer[offset] = 0x70;
buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
/* ILLEGAL REQUEST */
buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
/* LOGICAL BLOCK ADDRESS OUT OF RANGE */
buffer[offset+SPC_ASC_KEY_OFFSET] = 0x21;
break;
case TCM_CHECK_CONDITION_UNIT_ATTENTION: case TCM_CHECK_CONDITION_UNIT_ATTENTION:
/* CURRENT ERROR */ /* CURRENT ERROR */
buffer[offset] = 0x70; buffer[offset] = 0x70;
......
...@@ -157,6 +157,7 @@ enum tcm_sense_reason_table { ...@@ -157,6 +157,7 @@ enum tcm_sense_reason_table {
TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e,
TCM_CHECK_CONDITION_NOT_READY = 0x0f, TCM_CHECK_CONDITION_NOT_READY = 0x0f,
TCM_RESERVATION_CONFLICT = 0x10, TCM_RESERVATION_CONFLICT = 0x10,
TCM_ADDRESS_OUT_OF_RANGE = 0x11,
}; };
struct se_obj { struct se_obj {
......
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