diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-06 22:00:42 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-06 22:00:42 -0500 |
| commit | 6aad3738f6a79fd0ca480eaceefe064cc471f6eb (patch) | |
| tree | 08fb9ec4824bf3320af01f29fe84b75f814c0fa0 | |
| parent | 02ebbbd481635fd3ce7018e5bb19c18c0f1e4561 (diff) | |
| parent | 5bda90c8f20f0af93375721533f4081a40fa6f41 (diff) | |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
target: use ->exectute_task for all CDB emulation
target: remove SCF_EMULATE_CDB_ASYNC
target: refactor transport_emulate_control_cdb
target: pass the se_task to the CDB emulation callback
target: split core_scsi3_emulate_pr
target: split core_scsi2_emulate_crh
target: Add generic active I/O shutdown logic
target: add back error handling in transport_complete_task
target/pscsi: blk_make_request() returns an ERR_PTR()
target: Remove core TRANSPORT_FREE_CMD_INTR usage
target: Make TFO->check_stop_free return free status
iscsi-target: Fix non-immediate TMR handling
iscsi-target: Add missing CMDSN_LOWER_THAN_EXP check in iscsit_handle_scsi_cmd
target: Avoid double list_del for aborted se_tmr_req
target: Minor cleanups to core_tmr_drain_tmr_list
target: Fix wrong se_tmr being added to drain_tmr_list
target: Fix incorrect se_cmd assignment in core_tmr_drain_tmr_list
target: Check -ENOMEM to signal QUEUE_FULL from fabric callbacks
tcm_loop: Add explict read buffer memset for SCF_SCSI_CONTROL_SG_IO_CDB
target: Fix compile warning w/ missing module.h include
| -rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 11 | ||||
| -rw-r--r-- | drivers/target/loopback/tcm_loop.c | 23 | ||||
| -rw-r--r-- | drivers/target/target_core_alua.c | 11 | ||||
| -rw-r--r-- | drivers/target/target_core_alua.h | 4 | ||||
| -rw-r--r-- | drivers/target/target_core_cdb.c | 216 | ||||
| -rw-r--r-- | drivers/target/target_core_cdb.h | 14 | ||||
| -rw-r--r-- | drivers/target/target_core_device.c | 14 | ||||
| -rw-r--r-- | drivers/target/target_core_pr.c | 349 | ||||
| -rw-r--r-- | drivers/target/target_core_pr.h | 7 | ||||
| -rw-r--r-- | drivers/target/target_core_pscsi.c | 2 | ||||
| -rw-r--r-- | drivers/target/target_core_tmr.c | 23 | ||||
| -rw-r--r-- | drivers/target/target_core_transport.c | 392 | ||||
| -rw-r--r-- | drivers/target/tcm_fc/tcm_fc.h | 2 | ||||
| -rw-r--r-- | drivers/target/tcm_fc/tfc_cmd.c | 3 | ||||
| -rw-r--r-- | include/target/target_core_base.h | 13 | ||||
| -rw-r--r-- | include/target/target_core_device.h | 2 | ||||
| -rw-r--r-- | include/target/target_core_fabric_ops.h | 11 | ||||
| -rw-r--r-- | include/target/target_core_transport.h | 7 |
18 files changed, 629 insertions, 475 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 4d01768fcd90..1bf057ed9931 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
| @@ -1079,7 +1079,9 @@ attach_cmd: | |||
| 1079 | */ | 1079 | */ |
| 1080 | if (!cmd->immediate_data) { | 1080 | if (!cmd->immediate_data) { |
| 1081 | cmdsn_ret = iscsit_sequence_cmd(conn, cmd, hdr->cmdsn); | 1081 | cmdsn_ret = iscsit_sequence_cmd(conn, cmd, hdr->cmdsn); |
| 1082 | if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) | 1082 | if (cmdsn_ret == CMDSN_LOWER_THAN_EXP) |
| 1083 | return 0; | ||
| 1084 | else if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) | ||
| 1083 | return iscsit_add_reject_from_cmd( | 1085 | return iscsit_add_reject_from_cmd( |
| 1084 | ISCSI_REASON_PROTOCOL_ERROR, | 1086 | ISCSI_REASON_PROTOCOL_ERROR, |
| 1085 | 1, 0, buf, cmd); | 1087 | 1, 0, buf, cmd); |
| @@ -1819,17 +1821,16 @@ attach: | |||
| 1819 | int cmdsn_ret = iscsit_sequence_cmd(conn, cmd, hdr->cmdsn); | 1821 | int cmdsn_ret = iscsit_sequence_cmd(conn, cmd, hdr->cmdsn); |
| 1820 | if (cmdsn_ret == CMDSN_HIGHER_THAN_EXP) | 1822 | if (cmdsn_ret == CMDSN_HIGHER_THAN_EXP) |
| 1821 | out_of_order_cmdsn = 1; | 1823 | out_of_order_cmdsn = 1; |
| 1822 | else if (cmdsn_ret == CMDSN_LOWER_THAN_EXP) { | 1824 | else if (cmdsn_ret == CMDSN_LOWER_THAN_EXP) |
| 1823 | return 0; | 1825 | return 0; |
| 1824 | } else { /* (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) */ | 1826 | else if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) |
| 1825 | return iscsit_add_reject_from_cmd( | 1827 | return iscsit_add_reject_from_cmd( |
| 1826 | ISCSI_REASON_PROTOCOL_ERROR, | 1828 | ISCSI_REASON_PROTOCOL_ERROR, |
| 1827 | 1, 0, buf, cmd); | 1829 | 1, 0, buf, cmd); |
| 1828 | } | ||
| 1829 | } | 1830 | } |
| 1830 | iscsit_ack_from_expstatsn(conn, hdr->exp_statsn); | 1831 | iscsit_ack_from_expstatsn(conn, hdr->exp_statsn); |
| 1831 | 1832 | ||
| 1832 | if (out_of_order_cmdsn) | 1833 | if (out_of_order_cmdsn || !(hdr->opcode & ISCSI_OP_IMMEDIATE)) |
| 1833 | return 0; | 1834 | return 0; |
| 1834 | /* | 1835 | /* |
| 1835 | * Found the referenced task, send to transport for processing. | 1836 | * Found the referenced task, send to transport for processing. |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index b15d8cbf630b..3df1c9b8ae6b 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
| @@ -174,6 +174,24 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd) | |||
| 174 | sgl_bidi = sdb->table.sgl; | 174 | sgl_bidi = sdb->table.sgl; |
| 175 | sgl_bidi_count = sdb->table.nents; | 175 | sgl_bidi_count = sdb->table.nents; |
| 176 | } | 176 | } |
| 177 | /* | ||
| 178 | * Because some userspace code via scsi-generic do not memset their | ||
| 179 | * associated read buffers, go ahead and do that here for type | ||
| 180 | * SCF_SCSI_CONTROL_SG_IO_CDB. Also note that this is currently | ||
| 181 | * guaranteed to be a single SGL for SCF_SCSI_CONTROL_SG_IO_CDB | ||
| 182 | * by target core in transport_generic_allocate_tasks() -> | ||
| 183 | * transport_generic_cmd_sequencer(). | ||
| 184 | */ | ||
| 185 | if (se_cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB && | ||
| 186 | se_cmd->data_direction == DMA_FROM_DEVICE) { | ||
| 187 | struct scatterlist *sg = scsi_sglist(sc); | ||
| 188 | unsigned char *buf = kmap(sg_page(sg)) + sg->offset; | ||
| 189 | |||
| 190 | if (buf != NULL) { | ||
| 191 | memset(buf, 0, sg->length); | ||
| 192 | kunmap(sg_page(sg)); | ||
| 193 | } | ||
| 194 | } | ||
| 177 | 195 | ||
| 178 | /* Tell the core about our preallocated memory */ | 196 | /* Tell the core about our preallocated memory */ |
| 179 | ret = transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc), | 197 | ret = transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc), |
| @@ -187,7 +205,7 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd) | |||
| 187 | /* | 205 | /* |
| 188 | * Called from struct target_core_fabric_ops->check_stop_free() | 206 | * Called from struct target_core_fabric_ops->check_stop_free() |
| 189 | */ | 207 | */ |
| 190 | static void tcm_loop_check_stop_free(struct se_cmd *se_cmd) | 208 | static int tcm_loop_check_stop_free(struct se_cmd *se_cmd) |
| 191 | { | 209 | { |
| 192 | /* | 210 | /* |
| 193 | * Do not release struct se_cmd's containing a valid TMR | 211 | * Do not release struct se_cmd's containing a valid TMR |
| @@ -195,12 +213,13 @@ static void tcm_loop_check_stop_free(struct se_cmd *se_cmd) | |||
| 195 | * with transport_generic_free_cmd(). | 213 | * with transport_generic_free_cmd(). |
| 196 | */ | 214 | */ |
| 197 | if (se_cmd->se_tmr_req) | 215 | if (se_cmd->se_tmr_req) |
| 198 | return; | 216 | return 0; |
| 199 | /* | 217 | /* |
| 200 | * Release the struct se_cmd, which will make a callback to release | 218 | * Release the struct se_cmd, which will make a callback to release |
| 201 | * struct tcm_loop_cmd * in tcm_loop_deallocate_core_cmd() | 219 | * struct tcm_loop_cmd * in tcm_loop_deallocate_core_cmd() |
| 202 | */ | 220 | */ |
| 203 | transport_generic_free_cmd(se_cmd, 0); | 221 | transport_generic_free_cmd(se_cmd, 0); |
| 222 | return 1; | ||
| 204 | } | 223 | } |
| 205 | 224 | ||
| 206 | static void tcm_loop_release_cmd(struct se_cmd *se_cmd) | 225 | static void tcm_loop_release_cmd(struct se_cmd *se_cmd) |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 8f4447749c71..2739b93983a2 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
| @@ -58,8 +58,9 @@ struct t10_alua_lu_gp *default_lu_gp; | |||
| 58 | * | 58 | * |
| 59 | * See spc4r17 section 6.27 | 59 | * See spc4r17 section 6.27 |
| 60 | */ | 60 | */ |
| 61 | int core_emulate_report_target_port_groups(struct se_cmd *cmd) | 61 | int target_emulate_report_target_port_groups(struct se_task *task) |
| 62 | { | 62 | { |
| 63 | struct se_cmd *cmd = task->task_se_cmd; | ||
| 63 | struct se_subsystem_dev *su_dev = cmd->se_dev->se_sub_dev; | 64 | struct se_subsystem_dev *su_dev = cmd->se_dev->se_sub_dev; |
| 64 | struct se_port *port; | 65 | struct se_port *port; |
| 65 | struct t10_alua_tg_pt_gp *tg_pt_gp; | 66 | struct t10_alua_tg_pt_gp *tg_pt_gp; |
| @@ -164,6 +165,8 @@ int core_emulate_report_target_port_groups(struct se_cmd *cmd) | |||
| 164 | 165 | ||
| 165 | transport_kunmap_first_data_page(cmd); | 166 | transport_kunmap_first_data_page(cmd); |
| 166 | 167 | ||
| 168 | task->task_scsi_status = GOOD; | ||
| 169 | transport_complete_task(task, 1); | ||
| 167 | return 0; | 170 | return 0; |
| 168 | } | 171 | } |
| 169 | 172 | ||
| @@ -172,8 +175,9 @@ int core_emulate_report_target_port_groups(struct se_cmd *cmd) | |||
| 172 | * | 175 | * |
| 173 | * See spc4r17 section 6.35 | 176 | * See spc4r17 section 6.35 |
| 174 | */ | 177 | */ |
| 175 | int core_emulate_set_target_port_groups(struct se_cmd *cmd) | 178 | int target_emulate_set_target_port_groups(struct se_task *task) |
| 176 | { | 179 | { |
| 180 | struct se_cmd *cmd = task->task_se_cmd; | ||
| 177 | struct se_device *dev = cmd->se_dev; | 181 | struct se_device *dev = cmd->se_dev; |
| 178 | struct se_subsystem_dev *su_dev = dev->se_sub_dev; | 182 | struct se_subsystem_dev *su_dev = dev->se_sub_dev; |
| 179 | struct se_port *port, *l_port = cmd->se_lun->lun_sep; | 183 | struct se_port *port, *l_port = cmd->se_lun->lun_sep; |
| @@ -341,7 +345,8 @@ int core_emulate_set_target_port_groups(struct se_cmd *cmd) | |||
| 341 | 345 | ||
| 342 | out: | 346 | out: |
| 343 | transport_kunmap_first_data_page(cmd); | 347 | transport_kunmap_first_data_page(cmd); |
| 344 | 348 | task->task_scsi_status = GOOD; | |
| 349 | transport_complete_task(task, 1); | ||
