aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2012-07-16 18:34:21 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-07-16 20:35:35 -0400
commite2397c704429025bc6b331a970f699e52f34283e (patch)
tree470157d2f9a66ca40b295b9aa16c4fdf2222f15c /drivers/target
parentc8045372dd2d4784bc4cb32ddc27f4b88ff2140c (diff)
target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE
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: Roland Dreier <roland@purestorage.com> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_transport.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 357bb24afba2..14e54b48fb8c 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1640,6 +1640,7 @@ void transport_generic_request_failure(struct se_cmd *cmd)
1640 case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE: 1640 case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE:
1641 case TCM_UNKNOWN_MODE_PAGE: 1641 case TCM_UNKNOWN_MODE_PAGE:
1642 case TCM_WRITE_PROTECTED: 1642 case TCM_WRITE_PROTECTED:
1643 case TCM_ADDRESS_OUT_OF_RANGE:
1643 case TCM_CHECK_CONDITION_ABORT_CMD: 1644 case TCM_CHECK_CONDITION_ABORT_CMD:
1644 case TCM_CHECK_CONDITION_UNIT_ATTENTION: 1645 case TCM_CHECK_CONDITION_UNIT_ATTENTION:
1645 case TCM_CHECK_CONDITION_NOT_READY: 1646 case TCM_CHECK_CONDITION_NOT_READY:
@@ -2967,6 +2968,15 @@ int transport_send_check_condition_and_sense(
2967 /* WRITE PROTECTED */ 2968 /* WRITE PROTECTED */
2968 buffer[offset+SPC_ASC_KEY_OFFSET] = 0x27; 2969 buffer[offset+SPC_ASC_KEY_OFFSET] = 0x27;
2969 break; 2970 break;
2971 case TCM_ADDRESS_OUT_OF_RANGE:
2972 /* CURRENT ERROR */
2973 buffer[offset] = 0x70;
2974 buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
2975 /* ILLEGAL REQUEST */
2976 buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
2977 /* LOGICAL BLOCK ADDRESS OUT OF RANGE */
2978 buffer[offset+SPC_ASC_KEY_OFFSET] = 0x21;
2979 break;
2970 case TCM_CHECK_CONDITION_UNIT_ATTENTION: 2980 case TCM_CHECK_CONDITION_UNIT_ATTENTION:
2971 /* CURRENT ERROR */ 2981 /* CURRENT ERROR */
2972 buffer[offset] = 0x70; 2982 buffer[offset] = 0x70;