Commit a110af85 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen

scsi: qla2xxx: Fix double increment of switch scan retry count

This patch fixes issue when switch command fails, current code increments
retry count twice. This results in a smaller number of retries.
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 f3a03ee1
...@@ -3800,7 +3800,7 @@ static int qla2x00_post_gnnft_gpnft_done_work(struct scsi_qla_host *vha, ...@@ -3800,7 +3800,7 @@ static int qla2x00_post_gnnft_gpnft_done_work(struct scsi_qla_host *vha,
return qla2x00_post_work(vha, e); return qla2x00_post_work(vha, e);
} }
static int qla2x00_post_nvme_gpnft_done_work(struct scsi_qla_host *vha, static int qla2x00_post_nvme_gpnft_work(struct scsi_qla_host *vha,
srb_t *sp, int cmd) srb_t *sp, int cmd)
{ {
struct qla_work_evt *e; struct qla_work_evt *e;
...@@ -3930,6 +3930,7 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) ...@@ -3930,6 +3930,7 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res)
"Async done-%s res %x FC4Type %x\n", "Async done-%s res %x FC4Type %x\n",
sp->name, res, sp->gen2); sp->name, res, sp->gen2);
del_timer(&sp->u.iocb_cmd.timer);
sp->rc = res; sp->rc = res;
if (res) { if (res) {
unsigned long flags; unsigned long flags;
...@@ -3945,48 +3946,44 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) ...@@ -3945,48 +3946,44 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res)
if (rc) { if (rc) {
/* Cleanup here to prevent memory leak */ /* Cleanup here to prevent memory leak */
qla24xx_sp_unmap(vha, sp); qla24xx_sp_unmap(vha, sp);
}
spin_lock_irqsave(&vha->work_lock, flags); spin_lock_irqsave(&vha->work_lock, flags);
vha->scan.scan_flags &= ~SF_SCANNING; vha->scan.scan_flags &= ~SF_SCANNING;
vha->scan.scan_retry++; vha->scan.scan_retry++;
spin_unlock_irqrestore(&vha->work_lock, flags); spin_unlock_irqrestore(&vha->work_lock, flags);
if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { if (vha->scan.scan_retry < MAX_SCAN_RETRIES) {
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
qla2xxx_wake_dpc(vha); qla2xxx_wake_dpc(vha);
} else { } else {
ql_dbg(ql_dbg_disc, vha, 0xffff, ql_dbg(ql_dbg_disc, vha, 0xffff,
"Async done-%s rescan failed on all retries.\n", "Async done-%s rescan failed on all retries.\n",
name); name);
}
} }
return; return;
} }
if (!res) qla2x00_find_free_fcp_nvme_slot(vha, sp);
qla2x00_find_free_fcp_nvme_slot(vha, sp);
if ((fc4_type == FC4_TYPE_FCP_SCSI) && vha->flags.nvme_enabled && if ((fc4_type == FC4_TYPE_FCP_SCSI) && vha->flags.nvme_enabled &&
cmd == GNN_FT_CMD) { cmd == GNN_FT_CMD) {
del_timer(&sp->u.iocb_cmd.timer);
spin_lock_irqsave(&vha->work_lock, flags); spin_lock_irqsave(&vha->work_lock, flags);
vha->scan.scan_flags &= ~SF_SCANNING; vha->scan.scan_flags &= ~SF_SCANNING;
spin_unlock_irqrestore(&vha->work_lock, flags); spin_unlock_irqrestore(&vha->work_lock, flags);
sp->rc = res; sp->rc = res;
rc = qla2x00_post_nvme_gpnft_done_work(vha, sp, QLA_EVT_GPNFT); rc = qla2x00_post_nvme_gpnft_work(vha, sp, QLA_EVT_GPNFT);
if (rc) { if (rc) {
qla24xx_sp_unmap(vha, sp); qla24xx_sp_unmap(vha, sp);
set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
return;
} }
return; return;
} }
if (cmd == GPN_FT_CMD) { if (cmd == GPN_FT_CMD) {
del_timer(&sp->u.iocb_cmd.timer);
rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp, rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp,
QLA_EVT_GPNFT_DONE); QLA_EVT_GPNFT_DONE);
} else { } else {
......
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