diff options
author | Hannes Reinecke <hare@suse.de> | 2014-10-02 03:30:55 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-10-03 14:16:12 -0400 |
commit | 6375f8908255ea7438b60bb5998e6b3e1628500d (patch) | |
tree | e8a887292c2820129763c60b3bbc96a187a872b0 /drivers/target/loopback | |
parent | 1acff63f6ec2622662e647364293cc3ca495401f (diff) |
tcm_loop: Fixup tag handling
The SCSI command tag is set to the tag assigned from the block
layer, not the SCSI-II tag message. So we need to convert
it into the correct SCSI-II tag message based on the
device flags, not the tag value itself.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/loopback')
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index a7f6dc646045..ab3ab27d49b7 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -153,18 +153,11 @@ static int tcm_loop_change_queue_type(struct scsi_device *sdev, int tag) | |||
153 | /* | 153 | /* |
154 | * Locate the SAM Task Attr from struct scsi_cmnd * | 154 | * Locate the SAM Task Attr from struct scsi_cmnd * |
155 | */ | 155 | */ |
156 | static int tcm_loop_sam_attr(struct scsi_cmnd *sc) | 156 | static int tcm_loop_sam_attr(struct scsi_cmnd *sc, int tag) |
157 | { | 157 | { |
158 | if (sc->device->tagged_supported) { | 158 | if (sc->device->tagged_supported && |
159 | switch (sc->tag) { | 159 | sc->device->ordered_tags && tag >= 0) |
160 | case HEAD_OF_QUEUE_TAG: | 160 | return MSG_ORDERED_TAG; |
161 | return MSG_HEAD_TAG; | ||
162 | case ORDERED_QUEUE_TAG: | ||
163 | return MSG_ORDERED_TAG; | ||
164 | default: | ||
165 | break; | ||
166 | } | ||
167 | } | ||
168 | 161 | ||
169 | return MSG_SIMPLE_TAG; | 162 | return MSG_SIMPLE_TAG; |
170 | } | 163 | } |
@@ -227,7 +220,7 @@ static void tcm_loop_submission_work(struct work_struct *work) | |||
227 | 220 | ||
228 | rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd, | 221 | rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd, |
229 | &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun, | 222 | &tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun, |
230 | transfer_length, tcm_loop_sam_attr(sc), | 223 | transfer_length, tcm_loop_sam_attr(sc, tl_cmd->sc_cmd_tag), |
231 | sc->sc_data_direction, 0, | 224 | sc->sc_data_direction, 0, |
232 | scsi_sglist(sc), scsi_sg_count(sc), | 225 | scsi_sglist(sc), scsi_sg_count(sc), |
233 | sgl_bidi, sgl_bidi_count, | 226 | sgl_bidi, sgl_bidi_count, |
@@ -266,7 +259,7 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) | |||
266 | } | 259 | } |
267 | 260 | ||
268 | tl_cmd->sc = sc; | 261 | tl_cmd->sc = sc; |
269 | tl_cmd->sc_cmd_tag = sc->tag; | 262 | tl_cmd->sc_cmd_tag = sc->request->tag; |
270 | INIT_WORK(&tl_cmd->work, tcm_loop_submission_work); | 263 | INIT_WORK(&tl_cmd->work, tcm_loop_submission_work); |
271 | queue_work(tcm_loop_workqueue, &tl_cmd->work); | 264 | queue_work(tcm_loop_workqueue, &tl_cmd->work); |
272 | return 0; | 265 | return 0; |
@@ -370,7 +363,7 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc) | |||
370 | */ | 363 | */ |
371 | tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; | 364 | tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; |
372 | ret = tcm_loop_issue_tmr(tl_tpg, tl_nexus, sc->device->lun, | 365 | ret = tcm_loop_issue_tmr(tl_tpg, tl_nexus, sc->device->lun, |
373 | sc->tag, TMR_ABORT_TASK); | 366 | sc->request->tag, TMR_ABORT_TASK); |
374 | return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED; | 367 | return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED; |
375 | } | 368 | } |
376 | 369 | ||