diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-11-04 05:36:16 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-12-06 01:00:49 -0500 |
commit | 03e98c9eb916f3f0868c1dc344dde2a60287ff72 (patch) | |
tree | cfa47c1cec5b0a589b868c34310ee25f6a6a1939 /include/target | |
parent | 5611cc4572e889b62a7b4c72a413536bf6a9c416 (diff) |
target: Address legacy PYX_TRANSPORT_* return code breakage
This patch removes legacy usage of PYX_TRANSPORT_* return codes in a number
of locations and addresses cases where transport_generic_request_failure()
was returning the incorrect sense upon CHECK_CONDITION status after the
v3.1 converson to use errno return codes.
This includes the conversion of transport_generic_request_failure() to
process cmd->scsi_sense_reason and handle extra TCM_RESERVATION_CONFLICT
before calling transport_send_check_condition_and_sense() to queue up
response status. It also drops PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES legacy
usgae, and returns TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE w/ a response
for these cases.
transport_generic_allocate_tasks(), transport_generic_new_cmd(), backend
SCF_SCSI_DATA_SG_IO_CDB ->do_task(), and emulated ->execute_task() have
all been updated to set se_cmd->scsi_sense_reason and return errno codes
universally upon failure. This includes cmd->scsi_sense_reason assignment
in target_core_alua.c, target_core_pr.c and target_core_cdb.c emulation code.
Finally it updates fabric modules to remove the legacy usage, and for
TFO->new_cmd_map() callers forwards return values outside of fabric code.
iscsi-target has also been updated to remove a handful of special cases
related to the cleanup and signaling QUEUE_FULL handling w/ ft_write_pending()
(v2: Drop extra SCF_SCSI_CDB_EXCEPTION check during failure from
transport_generic_new_cmd, and re-add missing task->task_error_status
assignment in transport_complete_task)
Cc: Christoph Hellwig <hch@lst.de>
Cc: stable@kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
-rw-r--r-- | include/target/target_core_base.h | 4 | ||||
-rw-r--r-- | include/target/target_core_transport.h | 24 |
2 files changed, 1 insertions, 27 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 7f5fed3c89e1..4d0cb6b8c478 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -103,7 +103,6 @@ enum se_cmd_flags_table { | |||
103 | SCF_SCSI_NON_DATA_CDB = 0x00000040, | 103 | SCF_SCSI_NON_DATA_CDB = 0x00000040, |
104 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, | 104 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, |
105 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, | 105 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, |
106 | SCF_SE_CMD_FAILED = 0x00000400, | ||
107 | SCF_SE_LUN_CMD = 0x00000800, | 106 | SCF_SE_LUN_CMD = 0x00000800, |
108 | SCF_SE_ALLOW_EOO = 0x00001000, | 107 | SCF_SE_ALLOW_EOO = 0x00001000, |
109 | SCF_SENT_CHECK_CONDITION = 0x00004000, | 108 | SCF_SENT_CHECK_CONDITION = 0x00004000, |
@@ -154,6 +153,7 @@ enum tcm_sense_reason_table { | |||
154 | TCM_CHECK_CONDITION_ABORT_CMD = 0x0d, | 153 | TCM_CHECK_CONDITION_ABORT_CMD = 0x0d, |
155 | TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, | 154 | TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, |
156 | TCM_CHECK_CONDITION_NOT_READY = 0x0f, | 155 | TCM_CHECK_CONDITION_NOT_READY = 0x0f, |
156 | TCM_RESERVATION_CONFLICT = 0x10, | ||
157 | }; | 157 | }; |
158 | 158 | ||
159 | struct se_obj { | 159 | struct se_obj { |
@@ -422,8 +422,6 @@ struct se_cmd { | |||
422 | int sam_task_attr; | 422 | int sam_task_attr; |
423 | /* Transport protocol dependent state, see transport_state_table */ | 423 | /* Transport protocol dependent state, see transport_state_table */ |
424 | enum transport_state_table t_state; | 424 | enum transport_state_table t_state; |
425 | /* Transport specific error status */ | ||
426 | int transport_error_status; | ||
427 | /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ | 425 | /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ |
428 | int check_release:1; | 426 | int check_release:1; |
429 | int cmd_wait_set:1; | 427 | int cmd_wait_set:1; |
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h index c16e9431dd01..dac4f2d859fd 100644 --- a/include/target/target_core_transport.h +++ b/include/target/target_core_transport.h | |||
@@ -10,29 +10,6 @@ | |||
10 | 10 | ||
11 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ | 11 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ |
12 | 12 | ||
13 | #define PYX_TRANSPORT_SENT_TO_TRANSPORT 0 | ||
14 | #define PYX_TRANSPORT_WRITE_PENDING 1 | ||
15 | |||
16 | #define PYX_TRANSPORT_UNKNOWN_SAM_OPCODE -1 | ||
17 | #define PYX_TRANSPORT_HBA_QUEUE_FULL -2 | ||
18 | #define PYX_TRANSPORT_REQ_TOO_MANY_SECTORS -3 | ||
19 | #define PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES -4 | ||
20 | #define PYX_TRANSPORT_INVALID_CDB_FIELD -5 | ||
21 | #define PYX_TRANSPORT_INVALID_PARAMETER_LIST -6 | ||
22 | #define PYX_TRANSPORT_LU_COMM_FAILURE -7 | ||
23 | #define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8 | ||
24 | #define PYX_TRANSPORT_WRITE_PROTECTED -9 | ||
25 | #define PYX_TRANSPORT_RESERVATION_CONFLICT -10 | ||
26 | #define PYX_TRANSPORT_ILLEGAL_REQUEST -11 | ||
27 | #define PYX_TRANSPORT_USE_SENSE_REASON -12 | ||
28 | |||
29 | #ifndef SAM_STAT_RESERVATION_CONFLICT | ||
30 | #define SAM_STAT_RESERVATION_CONFLICT 0x18 | ||
31 | #endif | ||
32 | |||
33 | #define TRANSPORT_PLUGIN_FREE 0 | ||
34 | #define TRANSPORT_PLUGIN_REGISTERED 1 | ||
35 | |||
36 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 | 13 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 |
37 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 | 14 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 |
38 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 | 15 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 |
@@ -158,7 +135,6 @@ extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | |||
158 | extern int transport_handle_cdb_direct(struct se_cmd *); | 135 | extern int transport_handle_cdb_direct(struct se_cmd *); |
159 | extern int transport_generic_handle_cdb_map(struct se_cmd *); | 136 | extern int transport_generic_handle_cdb_map(struct se_cmd *); |
160 | extern int transport_generic_handle_data(struct se_cmd *); | 137 | extern int transport_generic_handle_data(struct se_cmd *); |
161 | extern void transport_new_cmd_failure(struct se_cmd *); | ||
162 | extern int transport_generic_handle_tmr(struct se_cmd *); | 138 | extern int transport_generic_handle_tmr(struct se_cmd *); |
163 | extern bool target_stop_task(struct se_task *task, unsigned long *flags); | 139 | extern bool target_stop_task(struct se_task *task, unsigned long *flags); |
164 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, | 140 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, |