From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> This patch explictly disabled the setting of CTIO7_FLAGS_EXPLICIT_CONFORM | CTIO7_FLAGS_CONFORM_REQ in qla24xx_init_ctio_ret_entry() to prevent SRRs from FCP READ CHECK_CONDITION + sense exceptions with a negotiated conf_compl_supported = 1 setup originally in qla_tgt_create_sess(). It also explictly clears qla_tgt_cmd->bufflen() in tcm_qla2xxx_queue_data_in module code for the same FCP_READ with CHECK_CONDITION status case. Reported-by: Roland Dreier <roland@xxxxxxxxxxxxxxx> Cc: Andrew Vasquez <andrew.vasquez@xxxxxxxxxx> Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxxxxxxxx> --- drivers/scsi/qla2xxx/qla_target.c | 7 +++++++ drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index f0b10ad..1d3b3b8 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -2402,10 +2402,17 @@ static void qla24xx_init_ctio_ret_entry(ctio7_status0_entry_t *ctio, ctio1 = (ctio7_status1_entry_t *)ctio; if (qla_tgt_need_explicit_conf(prm->tgt->ha, prm->cmd, 1)) { + if (prm->cmd->se_cmd.scsi_status != 0) { + DEBUG21(qla_printk(KERN_INFO, cmd->vha->hw, + "Skipping EXPLICIT_CONFORM and CTIO7_FLAGS_CONFORM_REQ" + " for FCP READ w/ non GOOD status\n")); + goto skip_explict_conf; + } ctio1->flags |= __constant_cpu_to_le16( CTIO7_FLAGS_EXPLICIT_CONFORM | CTIO7_FLAGS_CONFORM_REQ); } +skip_explict_conf: ctio1->flags &= ~__constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_0); ctio1->flags |= __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1); ctio1->scsi_status |= __constant_cpu_to_le16(SS_SENSE_LEN_VALID); diff --git a/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c b/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c index 10ec659..c0c7d2e 100644 --- a/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c +++ b/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c @@ -748,6 +748,7 @@ int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd) int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) { struct qla_tgt_cmd *cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); + int xmit_type = QLA_TGT_XMIT_STATUS; cmd->bufflen = se_cmd->data_length; cmd->sg = NULL; @@ -756,10 +757,17 @@ int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) cmd->dma_data_direction = se_cmd->data_direction; cmd->aborted = atomic_read(&se_cmd->t_transport_aborted); + if (se_cmd->data_direction == DMA_FROM_DEVICE) { + /* + * For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen + * for qla2xxx_xmit_response LLD code + */ + cmd->bufflen = 0; + } /* * Now queue status response to qla2xxx LLD code and response ring */ - return qla2xxx_xmit_response(cmd, QLA_TGT_XMIT_STATUS, se_cmd->scsi_status); + return qla2xxx_xmit_response(cmd, xmit_type, se_cmd->scsi_status); } int tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd) -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html