mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-21 06:50:25 +00:00
scsi: qla2xxx: Use QP lock to search for bsg
On bsg timeout, hardware_lock is used as part of search for the srb. Instead, qpair lock should be used to iterate through different qpair. Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Nilesh Javali <njavali@marvell.com> Link: https://lore.kernel.org/r/20240710171057.35066-11-njavali@marvell.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
beafd69246
commit
c449b41987
1 changed files with 57 additions and 39 deletions
|
@ -3059,43 +3059,29 @@ skip_chip_chk:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static bool qla_bsg_found(struct qla_qpair *qpair, struct bsg_job *bsg_job)
|
||||||
qla24xx_bsg_timeout(struct bsg_job *bsg_job)
|
|
||||||
{
|
{
|
||||||
|
bool found = false;
|
||||||
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
|
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
|
||||||
scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
|
scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
|
||||||
struct qla_hw_data *ha = vha->hw;
|
struct qla_hw_data *ha = vha->hw;
|
||||||
srb_t *sp;
|
srb_t *sp = NULL;
|
||||||
int cnt, que;
|
int cnt;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct req_que *req;
|
struct req_que *req;
|
||||||
|
|
||||||
ql_log(ql_log_info, vha, 0x708b, "%s CMD timeout. bsg ptr %p.\n",
|
spin_lock_irqsave(qpair->qp_lock_ptr, flags);
|
||||||
__func__, bsg_job);
|
req = qpair->req;
|
||||||
|
|
||||||
if (qla2x00_isp_reg_stat(ha)) {
|
|
||||||
ql_log(ql_log_info, vha, 0x9007,
|
|
||||||
"PCI/Register disconnect.\n");
|
|
||||||
qla_pci_set_eeh_busy(vha);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find the bsg job from the active list of commands */
|
|
||||||
spin_lock_irqsave(&ha->hardware_lock, flags);
|
|
||||||
for (que = 0; que < ha->max_req_queues; que++) {
|
|
||||||
req = ha->req_q_map[que];
|
|
||||||
if (!req)
|
|
||||||
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 &&
|
||||||
(sp->type == SRB_CT_CMD ||
|
(sp->type == SRB_CT_CMD ||
|
||||||
sp->type == SRB_ELS_CMD_HST ||
|
sp->type == SRB_ELS_CMD_HST ||
|
||||||
sp->type == SRB_ELS_CMD_HST_NOLOGIN ||
|
sp->type == SRB_ELS_CMD_HST_NOLOGIN) &&
|
||||||
sp->type == SRB_FXIOCB_BCMD) &&
|
|
||||||
sp->u.bsg_job == bsg_job) {
|
sp->u.bsg_job == bsg_job) {
|
||||||
req->outstanding_cmds[cnt] = NULL;
|
req->outstanding_cmds[cnt] = NULL;
|
||||||
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
|
||||||
|
|
||||||
if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) {
|
if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) {
|
||||||
ql_log(ql_log_warn, vha, 0x7089,
|
ql_log(ql_log_warn, vha, 0x7089,
|
||||||
|
@ -3106,21 +3092,53 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)
|
||||||
"mbx abort_command success.\n");
|
"mbx abort_command success.\n");
|
||||||
bsg_reply->result = 0;
|
bsg_reply->result = 0;
|
||||||
}
|
}
|
||||||
spin_lock_irqsave(&ha->hardware_lock, flags);
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
|
||||||
ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n");
|
|
||||||
bsg_reply->result = -ENXIO;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
|
||||||
/* ref: INIT */
|
/* ref: INIT */
|
||||||
kref_put(&sp->cmd_kref, qla2x00_sp_release);
|
kref_put(&sp->cmd_kref, qla2x00_sp_release);
|
||||||
|
|
||||||
|
found = true;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
|
||||||
|
|
||||||
|
done:
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
qla24xx_bsg_timeout(struct bsg_job *bsg_job)
|
||||||
|
{
|
||||||
|
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
|
||||||
|
scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
|
||||||
|
struct qla_hw_data *ha = vha->hw;
|
||||||
|
int i;
|
||||||
|
struct qla_qpair *qpair;
|
||||||
|
|
||||||
|
ql_log(ql_log_info, vha, 0x708b, "%s CMD timeout. bsg ptr %p.\n",
|
||||||
|
__func__, bsg_job);
|
||||||
|
|
||||||
|
if (qla2x00_isp_reg_stat(ha)) {
|
||||||
|
ql_log(ql_log_info, vha, 0x9007,
|
||||||
|
"PCI/Register disconnect.\n");
|
||||||
|
qla_pci_set_eeh_busy(vha);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qla_bsg_found(ha->base_qpair, bsg_job))
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
/* find the bsg job from the active list of commands */
|
||||||
|
for (i = 0; i < ha->max_qpairs; i++) {
|
||||||
|
qpair = vha->hw->queue_pair_map[i];
|
||||||
|
if (!qpair)
|
||||||
|
continue;
|
||||||
|
if (qla_bsg_found(qpair, bsg_job))
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n");
|
||||||
|
bsg_reply->result = -ENXIO;
|
||||||
|
|
||||||
|
done:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue