diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-05-20 14:35:02 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-07-16 20:29:11 -0400 |
commit | 9f3eb93eaf5bd49051458fcb098af3fcf111d3d0 (patch) | |
tree | 449b9eafb1921bbfce0684e15b098691ddc2e412 /drivers/target/iscsi | |
parent | 5f41a31d0a49a014adb1588edd0cc7f7e30cc55b (diff) |
target: move ref_cmd from the generic se_tmr_req into iscsi code
Also remove the unused ref_task_lun field in struct se_tmr_req.
(nab: Add missing TASK_REASSIGN ref_lun vs. ref_cmd orig_fe_lun checks
in iscsit_tmr_task_reassign)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_core.h | 1 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tmr.c | 43 |
2 files changed, 21 insertions, 23 deletions
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 1c70144cdaf1..63a8ed26f119 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
@@ -481,6 +481,7 @@ struct iscsi_tmr_req { | |||
481 | bool task_reassign:1; | 481 | bool task_reassign:1; |
482 | u32 ref_cmd_sn; | 482 | u32 ref_cmd_sn; |
483 | u32 exp_data_sn; | 483 | u32 exp_data_sn; |
484 | struct iscsi_cmd *ref_cmd; | ||
484 | struct iscsi_conn_recovery *conn_recovery; | 485 | struct iscsi_conn_recovery *conn_recovery; |
485 | struct se_tmr_req *se_tmr_req; | 486 | struct se_tmr_req *se_tmr_req; |
486 | }; | 487 | }; |
diff --git a/drivers/target/iscsi/iscsi_target_tmr.c b/drivers/target/iscsi/iscsi_target_tmr.c index f4e640b51fd1..1f7552986168 100644 --- a/drivers/target/iscsi/iscsi_target_tmr.c +++ b/drivers/target/iscsi/iscsi_target_tmr.c | |||
@@ -19,6 +19,7 @@ | |||
19 | ******************************************************************************/ | 19 | ******************************************************************************/ |
20 | 20 | ||
21 | #include <asm/unaligned.h> | 21 | #include <asm/unaligned.h> |
22 | #include <scsi/scsi_device.h> | ||
22 | #include <scsi/iscsi_proto.h> | 23 | #include <scsi/iscsi_proto.h> |
23 | #include <target/target_core_base.h> | 24 | #include <target/target_core_base.h> |
24 | #include <target/target_core_fabric.h> | 25 | #include <target/target_core_fabric.h> |
@@ -61,7 +62,7 @@ u8 iscsit_tmr_abort_task( | |||
61 | } | 62 | } |
62 | 63 | ||
63 | se_tmr->ref_task_tag = hdr->rtt; | 64 | se_tmr->ref_task_tag = hdr->rtt; |
64 | se_tmr->ref_cmd = &ref_cmd->se_cmd; | 65 | tmr_req->ref_cmd = ref_cmd; |
65 | tmr_req->ref_cmd_sn = hdr->refcmdsn; | 66 | tmr_req->ref_cmd_sn = hdr->refcmdsn; |
66 | tmr_req->exp_data_sn = hdr->exp_datasn; | 67 | tmr_req->exp_data_sn = hdr->exp_datasn; |
67 | 68 | ||
@@ -121,7 +122,7 @@ u8 iscsit_tmr_task_reassign( | |||
121 | struct iscsi_tmr_req *tmr_req = cmd->tmr_req; | 122 | struct iscsi_tmr_req *tmr_req = cmd->tmr_req; |
122 | struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; | 123 | struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; |
123 | struct iscsi_tm *hdr = (struct iscsi_tm *) buf; | 124 | struct iscsi_tm *hdr = (struct iscsi_tm *) buf; |
124 | int ret; | 125 | int ret, ref_lun; |
125 | 126 | ||
126 | pr_debug("Got TASK_REASSIGN TMR ITT: 0x%08x," | 127 | pr_debug("Got TASK_REASSIGN TMR ITT: 0x%08x," |
127 | " RefTaskTag: 0x%08x, ExpDataSN: 0x%08x, CID: %hu\n", | 128 | " RefTaskTag: 0x%08x, ExpDataSN: 0x%08x, CID: %hu\n", |
@@ -155,9 +156,16 @@ u8 iscsit_tmr_task_reassign( | |||
155 | return ISCSI_TMF_RSP_REJECTED; | 156 | return ISCSI_TMF_RSP_REJECTED; |
156 | } | 157 | } |
157 | 158 | ||
159 | ref_lun = scsilun_to_int(&hdr->lun); | ||
160 | if (ref_lun != ref_cmd->se_cmd.orig_fe_lun) { | ||
161 | pr_err("Unable to perform connection recovery for" | ||
162 | " differing ref_lun: %d ref_cmd orig_fe_lun: %u\n", | ||
163 | ref_lun, ref_cmd->se_cmd.orig_fe_lun); | ||
164 | return ISCSI_TMF_RSP_REJECTED; | ||
165 | } | ||
166 | |||
158 | se_tmr->ref_task_tag = hdr->rtt; | 167 | se_tmr->ref_task_tag = hdr->rtt; |
159 | se_tmr->ref_cmd = &ref_cmd->se_cmd; | 168 | tmr_req->ref_cmd = ref_cmd; |
160 | se_tmr->ref_task_lun = get_unaligned_le64(&hdr->lun); | ||
161 | tmr_req->ref_cmd_sn = hdr->refcmdsn; | 169 | tmr_req->ref_cmd_sn = hdr->refcmdsn; |
162 | tmr_req->exp_data_sn = hdr->exp_datasn; | 170 | tmr_req->exp_data_sn = hdr->exp_datasn; |
163 | tmr_req->conn_recovery = cr; | 171 | tmr_req->conn_recovery = cr; |
@@ -191,9 +199,7 @@ static int iscsit_task_reassign_complete_nop_out( | |||
191 | struct iscsi_tmr_req *tmr_req, | 199 | struct iscsi_tmr_req *tmr_req, |
192 | struct iscsi_conn *conn) | 200 | struct iscsi_conn *conn) |
193 | { | 201 | { |
194 | struct se_tmr_req *se_tmr = tmr_req->se_tmr_req; | 202 | struct iscsi_cmd *cmd = tmr_req->ref_cmd; |
195 | struct se_cmd *se_cmd = se_tmr->ref_cmd; | ||
196 | struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); | ||
197 | struct iscsi_conn_recovery *cr; | 203 | struct iscsi_conn_recovery *cr; |
198 | 204 | ||
199 | if (!cmd->cr) { | 205 | if (!cmd->cr) { |
@@ -360,9 +366,7 @@ static int iscsit_task_reassign_complete_scsi_cmnd( | |||
360 | struct iscsi_tmr_req *tmr_req, | 366 | struct iscsi_tmr_req *tmr_req, |
361 | struct iscsi_conn *conn) | 367 | struct iscsi_conn *conn) |
362 | { | 368 | { |
363 | struct se_tmr_req *se_tmr = tmr_req->se_tmr_req; | 369 | struct iscsi_cmd *cmd = tmr_req->ref_cmd; |
364 | struct se_cmd *se_cmd = se_tmr->ref_cmd; | ||
365 | struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); | ||
366 | struct iscsi_conn_recovery *cr; | 370 | struct iscsi_conn_recovery *cr; |
367 | 371 | ||
368 | if (!cmd->cr) { | 372 | if (!cmd->cr) { |
@@ -385,7 +389,7 @@ static int iscsit_task_reassign_complete_scsi_cmnd( | |||
385 | list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); | 389 | list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); |
386 | spin_unlock_bh(&conn->cmd_lock); | 390 | spin_unlock_bh(&conn->cmd_lock); |
387 | 391 | ||
388 | if (se_cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) { | 392 | if (cmd->se_cmd.se_cmd_flags & SCF_SENT_CHECK_CONDITION) { |
389 | cmd->i_state = ISTATE_SEND_STATUS; | 393 | cmd->i_state = ISTATE_SEND_STATUS; |
390 | iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); | 394 | iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); |
391 | return 0; | 395 | return 0; |
@@ -411,17 +415,14 @@ static int iscsit_task_reassign_complete( | |||
411 | struct iscsi_tmr_req *tmr_req, | 415 | struct iscsi_tmr_req *tmr_req, |
412 | struct iscsi_conn *conn) | 416 | struct iscsi_conn *conn) |
413 | { | 417 | { |
414 | struct se_tmr_req *se_tmr = tmr_req->se_tmr_req; | ||
415 | struct se_cmd *se_cmd; | ||
416 | struct iscsi_cmd *cmd; | 418 | struct iscsi_cmd *cmd; |
417 | int ret = 0; | 419 | int ret = 0; |
418 | 420 | ||
419 | if (!se_tmr->ref_cmd) { | 421 | if (!tmr_req->ref_cmd) { |
420 | pr_err("TMR Request is missing a RefCmd struct iscsi_cmd.\n"); | 422 | pr_err("TMR Request is missing a RefCmd struct iscsi_cmd.\n"); |
421 | return -1; | 423 | return -1; |
422 | } | 424 | } |
423 | se_cmd = se_tmr->ref_cmd; | 425 | cmd = tmr_req->ref_cmd; |
424 | cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); | ||
425 | 426 | ||
426 | cmd->conn = conn; | 427 | cmd->conn = conn; |
427 | 428 | ||
@@ -547,9 +548,7 @@ int iscsit_task_reassign_prepare_write( | |||
547 | struct iscsi_tmr_req *tmr_req, | 548 | struct iscsi_tmr_req *tmr_req, |
548 | struct iscsi_conn *conn) | 549 | struct iscsi_conn *conn) |
549 | { | 550 | { |
550 | struct se_tmr_req *se_tmr = tmr_req->se_tmr_req; | 551 | struct iscsi_cmd *cmd = tmr_req->ref_cmd; |
551 | struct se_cmd *se_cmd = se_tmr->ref_cmd; | ||
552 | struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); | ||
553 | struct iscsi_pdu *pdu = NULL; | 552 | struct iscsi_pdu *pdu = NULL; |
554 | struct iscsi_r2t *r2t = NULL, *r2t_tmp; | 553 | struct iscsi_r2t *r2t = NULL, *r2t_tmp; |
555 | int first_incomplete_r2t = 1, i = 0; | 554 | int first_incomplete_r2t = 1, i = 0; |
@@ -782,14 +781,12 @@ int iscsit_check_task_reassign_expdatasn( | |||
782 | struct iscsi_tmr_req *tmr_req, | 781 | struct iscsi_tmr_req *tmr_req, |
783 | struct iscsi_conn *conn) | 782 | struct iscsi_conn *conn) |
784 | { | 783 | { |
785 | struct se_tmr_req *se_tmr = tmr_req->se_tmr_req; | 784 | struct iscsi_cmd *ref_cmd = tmr_req->ref_cmd; |
786 | struct se_cmd *se_cmd = se_tmr->ref_cmd; | ||
787 | struct iscsi_cmd *ref_cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); | ||
788 | 785 | ||
789 | if (ref_cmd->iscsi_opcode != ISCSI_OP_SCSI_CMD) | 786 | if (ref_cmd->iscsi_opcode != ISCSI_OP_SCSI_CMD) |
790 | return 0; | 787 | return 0; |
791 | 788 | ||
792 | if (se_cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) | 789 | if (ref_cmd->se_cmd.se_cmd_flags & SCF_SENT_CHECK_CONDITION) |
793 | return 0; | 790 | return 0; |
794 | 791 | ||
795 | if (ref_cmd->data_direction == DMA_NONE) | 792 | if (ref_cmd->data_direction == DMA_NONE) |