Commit 9ca1d01f authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley
Browse files

[SCSI] qla2xxx: Properly check FCP_RSP response-info field after TMF completion.



Original code discarded response-info field information and
assumed the command completed successfully without verifying the
target's status within the FCP_RSP packet.
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarGiridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent f3a0a77e
...@@ -2318,6 +2318,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, ...@@ -2318,6 +2318,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
{ {
int rval, rval2; int rval, rval2;
struct tsk_mgmt_cmd *tsk; struct tsk_mgmt_cmd *tsk;
struct sts_entry_24xx *sts;
dma_addr_t tsk_dma; dma_addr_t tsk_dma;
scsi_qla_host_t *vha; scsi_qla_host_t *vha;
struct qla_hw_data *ha; struct qla_hw_data *ha;
...@@ -2357,20 +2358,37 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, ...@@ -2357,20 +2358,37 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
sizeof(tsk->p.tsk.lun)); sizeof(tsk->p.tsk.lun));
} }
sts = &tsk->p.sts;
rval = qla2x00_issue_iocb(vha, tsk, tsk_dma, 0); rval = qla2x00_issue_iocb(vha, tsk, tsk_dma, 0);
if (rval != QLA_SUCCESS) { if (rval != QLA_SUCCESS) {
DEBUG2_3_11(printk("%s(%ld): failed to issue %s Reset IOCB " DEBUG2_3_11(printk("%s(%ld): failed to issue %s Reset IOCB "
"(%x).\n", __func__, vha->host_no, name, rval)); "(%x).\n", __func__, vha->host_no, name, rval));
} else if (tsk->p.sts.entry_status != 0) { } else if (sts->entry_status != 0) {
DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
"-- error status (%x).\n", __func__, vha->host_no, "-- error status (%x).\n", __func__, vha->host_no,
tsk->p.sts.entry_status)); sts->entry_status));
rval = QLA_FUNCTION_FAILED; rval = QLA_FUNCTION_FAILED;
} else if (tsk->p.sts.comp_status != } else if (sts->comp_status !=
__constant_cpu_to_le16(CS_COMPLETE)) { __constant_cpu_to_le16(CS_COMPLETE)) {
DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
"-- completion status (%x).\n", __func__, "-- completion status (%x).\n", __func__,
vha->host_no, le16_to_cpu(tsk->p.sts.comp_status))); vha->host_no, le16_to_cpu(sts->comp_status)));
rval = QLA_FUNCTION_FAILED;
} else if (!(le16_to_cpu(sts->scsi_status) &
SS_RESPONSE_INFO_LEN_VALID)) {
DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
"-- no response info (%x).\n", __func__, vha->host_no,
le16_to_cpu(sts->scsi_status)));
rval = QLA_FUNCTION_FAILED;
} else if (le32_to_cpu(sts->rsp_data_len) < 4) {
DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
"-- not enough response info (%d).\n", __func__,
vha->host_no, le32_to_cpu(sts->rsp_data_len)));
rval = QLA_FUNCTION_FAILED;
} else if (sts->data[3]) {
DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
"-- response (%x).\n", __func__,
vha->host_no, sts->data[3]));
rval = QLA_FUNCTION_FAILED; rval = QLA_FUNCTION_FAILED;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment