aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi/iscsi_target_tmr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_tmr.c')
-rw-r--r--drivers/target/iscsi/iscsi_target_tmr.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/target/iscsi/iscsi_target_tmr.c b/drivers/target/iscsi/iscsi_target_tmr.c
index f62fe123d902..4a99820d063b 100644
--- a/drivers/target/iscsi/iscsi_target_tmr.c
+++ b/drivers/target/iscsi/iscsi_target_tmr.c
@@ -50,21 +50,20 @@ u8 iscsit_tmr_abort_task(
50 if (!ref_cmd) { 50 if (!ref_cmd) {
51 pr_err("Unable to locate RefTaskTag: 0x%08x on CID:" 51 pr_err("Unable to locate RefTaskTag: 0x%08x on CID:"
52 " %hu.\n", hdr->rtt, conn->cid); 52 " %hu.\n", hdr->rtt, conn->cid);
53 return ((hdr->refcmdsn >= conn->sess->exp_cmd_sn) && 53 return (be32_to_cpu(hdr->refcmdsn) >= conn->sess->exp_cmd_sn &&
54 (hdr->refcmdsn <= conn->sess->max_cmd_sn)) ? 54 be32_to_cpu(hdr->refcmdsn) <= conn->sess->max_cmd_sn) ?
55 ISCSI_TMF_RSP_COMPLETE : ISCSI_TMF_RSP_NO_TASK; 55 ISCSI_TMF_RSP_COMPLETE : ISCSI_TMF_RSP_NO_TASK;
56 } 56 }
57 if (ref_cmd->cmd_sn != hdr->refcmdsn) { 57 if (ref_cmd->cmd_sn != be32_to_cpu(hdr->refcmdsn)) {
58 pr_err("RefCmdSN 0x%08x does not equal" 58 pr_err("RefCmdSN 0x%08x does not equal"
59 " task's CmdSN 0x%08x. Rejecting ABORT_TASK.\n", 59 " task's CmdSN 0x%08x. Rejecting ABORT_TASK.\n",
60 hdr->refcmdsn, ref_cmd->cmd_sn); 60 hdr->refcmdsn, ref_cmd->cmd_sn);
61 return ISCSI_TMF_RSP_REJECTED; 61 return ISCSI_TMF_RSP_REJECTED;
62 } 62 }
63 63
64 se_tmr->ref_task_tag = hdr->rtt; 64 se_tmr->ref_task_tag = (__force u32)hdr->rtt;
65 tmr_req->ref_cmd = ref_cmd; 65 tmr_req->ref_cmd = ref_cmd;
66 tmr_req->ref_cmd_sn = hdr->refcmdsn; 66 tmr_req->exp_data_sn = be32_to_cpu(hdr->exp_datasn);
67 tmr_req->exp_data_sn = hdr->exp_datasn;
68 67
69 return ISCSI_TMF_RSP_COMPLETE; 68 return ISCSI_TMF_RSP_COMPLETE;
70} 69}
@@ -146,7 +145,7 @@ u8 iscsit_tmr_task_reassign(
146 } 145 }
147 /* 146 /*
148 * Temporary check to prevent connection recovery for 147 * Temporary check to prevent connection recovery for
149 * connections with a differing MaxRecvDataSegmentLength. 148 * connections with a differing Max*DataSegmentLength.
150 */ 149 */
151 if (cr->maxrecvdatasegmentlength != 150 if (cr->maxrecvdatasegmentlength !=
152 conn->conn_ops->MaxRecvDataSegmentLength) { 151 conn->conn_ops->MaxRecvDataSegmentLength) {
@@ -155,6 +154,13 @@ u8 iscsit_tmr_task_reassign(
155 " TMR TASK_REASSIGN.\n"); 154 " TMR TASK_REASSIGN.\n");
156 return ISCSI_TMF_RSP_REJECTED; 155 return ISCSI_TMF_RSP_REJECTED;
157 } 156 }
157 if (cr->maxxmitdatasegmentlength !=
158 conn->conn_ops->MaxXmitDataSegmentLength) {
159 pr_err("Unable to perform connection recovery for"
160 " differing MaxXmitDataSegmentLength, rejecting"
161 " TMR TASK_REASSIGN.\n");
162 return ISCSI_TMF_RSP_REJECTED;
163 }
158 164
159 ref_lun = scsilun_to_int(&hdr->lun); 165 ref_lun = scsilun_to_int(&hdr->lun);
160 if (ref_lun != ref_cmd->se_cmd.orig_fe_lun) { 166 if (ref_lun != ref_cmd->se_cmd.orig_fe_lun) {
@@ -164,10 +170,9 @@ u8 iscsit_tmr_task_reassign(
164 return ISCSI_TMF_RSP_REJECTED; 170 return ISCSI_TMF_RSP_REJECTED;
165 } 171 }
166 172
167 se_tmr->ref_task_tag = hdr->rtt; 173 se_tmr->ref_task_tag = (__force u32)hdr->rtt;
168 tmr_req->ref_cmd = ref_cmd; 174 tmr_req->ref_cmd = ref_cmd;
169 tmr_req->ref_cmd_sn = hdr->refcmdsn; 175 tmr_req->exp_data_sn = be32_to_cpu(hdr->exp_datasn);
170 tmr_req->exp_data_sn = hdr->exp_datasn;
171 tmr_req->conn_recovery = cr; 176 tmr_req->conn_recovery = cr;
172 tmr_req->task_reassign = 1; 177 tmr_req->task_reassign = 1;
173 /* 178 /*
@@ -455,7 +460,7 @@ static int iscsit_task_reassign_complete(
455 * Right now the only one that its really needed for is 460 * Right now the only one that its really needed for is
456 * connection recovery releated TASK_REASSIGN. 461 * connection recovery releated TASK_REASSIGN.
457 */ 462 */
458extern int iscsit_tmr_post_handler(struct iscsi_cmd *cmd, struct iscsi_conn *conn) 463int iscsit_tmr_post_handler(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
459{ 464{
460 struct iscsi_tmr_req *tmr_req = cmd->tmr_req; 465 struct iscsi_tmr_req *tmr_req = cmd->tmr_req;
461 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; 466 struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req;
@@ -470,7 +475,7 @@ extern int iscsit_tmr_post_handler(struct iscsi_cmd *cmd, struct iscsi_conn *con
470/* 475/*
471 * Nothing to do here, but leave it for good measure. :-) 476 * Nothing to do here, but leave it for good measure. :-)
472 */ 477 */
473int iscsit_task_reassign_prepare_read( 478static int iscsit_task_reassign_prepare_read(
474 struct iscsi_tmr_req *tmr_req, 479 struct iscsi_tmr_req *tmr_req,
475 struct iscsi_conn *conn) 480 struct iscsi_conn *conn)
476{ 481{
@@ -545,7 +550,7 @@ static void iscsit_task_reassign_prepare_unsolicited_dataout(
545 } 550 }
546} 551}
547 552
548int iscsit_task_reassign_prepare_write( 553static int iscsit_task_reassign_prepare_write(
549 struct iscsi_tmr_req *tmr_req, 554 struct iscsi_tmr_req *tmr_req,
550 struct iscsi_conn *conn) 555 struct iscsi_conn *conn)
551{ 556{