Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbead493 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen
Browse files

scsi: qla2xxx: Chip reset uses wrong lock during IO flush.



As part of chip reset, all commands from all QPairs are
flushed. This patch fixes code to use Q Pair lock for flush
instead of using old hardware_lock.

Signed-off-by: default avatarQuinn Tran <quinn.tran@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d1e3635a
Loading
Loading
Loading
Loading
+84 −74
Original line number Original line Diff line number Diff line
@@ -1704,25 +1704,21 @@ qla2x00_loop_reset(scsi_qla_host_t *vha)
	return QLA_SUCCESS;
	return QLA_SUCCESS;
}
}


void
static void
qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
__qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
{
{
	int que, cnt, status;
	int cnt, status;
	unsigned long flags;
	unsigned long flags;
	srb_t *sp;
	srb_t *sp;
	scsi_qla_host_t *vha = qp->vha;
	struct qla_hw_data *ha = vha->hw;
	struct qla_hw_data *ha = vha->hw;
	struct req_que *req;
	struct req_que *req;
	struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
	struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
	struct qla_tgt_cmd *cmd;
	struct qla_tgt_cmd *cmd;
	uint8_t trace = 0;
	uint8_t trace = 0;


	spin_lock_irqsave(&ha->hardware_lock, flags);
	spin_lock_irqsave(qp->qp_lock_ptr, flags);
	for (que = 0; que < ha->max_req_queues; que++) {
	req = qp->req;
		req = ha->req_q_map[que];
		if (!req)
			continue;
		if (!req->outstanding_cmds)
			continue;
	for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
	for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
		sp = req->outstanding_cmds[cnt];
		sp = req->outstanding_cmds[cnt];
		if (sp) {
		if (sp) {
@@ -1731,11 +1727,11 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
				if (sp->type == SRB_NVME_CMD ||
				if (sp->type == SRB_NVME_CMD ||
				    sp->type == SRB_NVME_LS) {
				    sp->type == SRB_NVME_LS) {
					sp_get(sp);
					sp_get(sp);
						spin_unlock_irqrestore(
					spin_unlock_irqrestore(qp->qp_lock_ptr,
						    &ha->hardware_lock, flags);
					    flags);
					qla_nvme_abort(ha, sp);
					qla_nvme_abort(ha, sp);
						spin_lock_irqsave(
					spin_lock_irqsave(qp->qp_lock_ptr,
						    &ha->hardware_lock, flags);
					    flags);
				} else if (GET_CMD_SP(sp) &&
				} else if (GET_CMD_SP(sp) &&
				    !ha->flags.eeh_busy &&
				    !ha->flags.eeh_busy &&
				    (!test_bit(ABORT_ISP_ACTIVE,
				    (!test_bit(ABORT_ISP_ACTIVE,
@@ -1756,12 +1752,12 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
					 * result 'res').
					 * result 'res').
					 */
					 */
					sp_get(sp);
					sp_get(sp);
						spin_unlock_irqrestore(
					spin_unlock_irqrestore(qp->qp_lock_ptr,
						    &ha->hardware_lock, flags);
					    flags);
					status = qla2xxx_eh_abort(
					status = qla2xxx_eh_abort(
					    GET_CMD_SP(sp));
					    GET_CMD_SP(sp));
						spin_lock_irqsave(
					spin_lock_irqsave(qp->qp_lock_ptr,
						    &ha->hardware_lock, flags);
					    flags);
					/*
					/*
					 * Get rid of extra reference
					 * Get rid of extra reference
					 * if immediate exit from
					 * if immediate exit from
@@ -1784,13 +1780,27 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
					continue;
					continue;
				}
				}
				cmd = (struct qla_tgt_cmd *)sp;
				cmd = (struct qla_tgt_cmd *)sp;
					qlt_abort_cmd_on_host_reset(cmd->vha,
				qlt_abort_cmd_on_host_reset(cmd->vha, cmd);
					    cmd);
			}
			}
		}
		}
	}
	}
	spin_unlock_irqrestore(qp->qp_lock_ptr, flags);
}

void
qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
{
	int que;
	struct qla_hw_data *ha = vha->hw;

	__qla2x00_abort_all_cmds(ha->base_qpair, res);

	for (que = 0; que < ha->max_qpairs; que++) {
		if (!ha->queue_pair_map[que])
			continue;

		__qla2x00_abort_all_cmds(ha->queue_pair_map[que], res);
	}
	}
	spin_unlock_irqrestore(&ha->hardware_lock, flags);
}
}


static int
static int