aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Hodgson <steve@purestorage.com>2012-11-16 11:06:17 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2012-11-28 01:49:17 -0500
commit06e97b489006f28e23bb028febfa1c01c266d676 (patch)
tree3ada5b691da89f035d637e83f75f42710bd01449
parentfd9a11d7076e1d534a760032d2b8f3b59e10f9b5 (diff)
qla2xxx: Look up LUN for abort requests
Search through the list of pending commands on the session list to find the command the initiator is actually aborting, so that we can pass the correct LUN to the core TMR handling code. (nab: Allow abort requests to work to LUN=0 with mainline target code) Signed-off-by: Steve Hodgson <steve@purestorage.com> Signed-off-by: Roland Dreier <roland@purestorage.com> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 62aa5584f644..661d33ed4d5d 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1264,8 +1264,27 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha,
1264 struct abts_recv_from_24xx *abts, struct qla_tgt_sess *sess) 1264 struct abts_recv_from_24xx *abts, struct qla_tgt_sess *sess)
1265{ 1265{
1266 struct qla_hw_data *ha = vha->hw; 1266 struct qla_hw_data *ha = vha->hw;
1267 struct se_session *se_sess = sess->se_sess;
1267 struct qla_tgt_mgmt_cmd *mcmd; 1268 struct qla_tgt_mgmt_cmd *mcmd;
1269 struct se_cmd *se_cmd;
1270 u32 lun = 0;
1268 int rc; 1271 int rc;
1272 bool found_lun = false;
1273
1274 spin_lock(&se_sess->sess_cmd_lock);
1275 list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) {
1276 struct qla_tgt_cmd *cmd =
1277 container_of(se_cmd, struct qla_tgt_cmd, se_cmd);
1278 if (cmd->tag == abts->exchange_addr_to_abort) {
1279 lun = cmd->unpacked_lun;
1280 found_lun = true;
1281 break;
1282 }
1283 }
1284 spin_unlock(&se_sess->sess_cmd_lock);
1285
1286 if (!found_lun)
1287 return -ENOENT;
1269 1288
1270 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00f, 1289 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00f,
1271 "qla_target(%d): task abort (tag=%d)\n", 1290 "qla_target(%d): task abort (tag=%d)\n",
@@ -1283,7 +1302,7 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha,
1283 mcmd->sess = sess; 1302 mcmd->sess = sess;
1284 memcpy(&mcmd->orig_iocb.abts, abts, sizeof(mcmd->orig_iocb.abts)); 1303 memcpy(&mcmd->orig_iocb.abts, abts, sizeof(mcmd->orig_iocb.abts));
1285 1304
1286 rc = ha->tgt.tgt_ops->handle_tmr(mcmd, 0, TMR_ABORT_TASK, 1305 rc = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, TMR_ABORT_TASK,
1287 abts->exchange_addr_to_abort); 1306 abts->exchange_addr_to_abort);
1288 if (rc != 0) { 1307 if (rc != 0) {
1289 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf052, 1308 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf052,