Skip to content

Commit 98f8d35

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Check SLI_ACTIVE flag in FDMI cmpl before submitting follow up FDMI
The lpfc_cmpl_ct_disc_fdmi() routine has incorrect logic that treats an FDMI completion with error LOCAL_REJECT/SLI_ABORTED as a success status. Under the erroneous assumption of successful completion, the routine proceeds to issue follow up FDMI commands, which may never complete if the HBA is in an errata state as indicated by the errored completion status. Fix by freeing FDMI cmd resources and early return when the LPFC_SLI_ACTIVE flag is not set and a LOCAL_REJECT/SLI_ABORTED or SLI_DOWN status is received. Signed-off-by: Justin Tee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 940ddac commit 98f8d35

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

drivers/scsi/lpfc/lpfc_ct.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,11 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
22262226
ulp_status, ulp_word4, latt);
22272227

22282228
if (latt || ulp_status) {
2229+
lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY,
2230+
"0229 FDMI cmd %04x failed, latt = %d "
2231+
"ulp_status: (x%x/x%x), sli_flag x%x\n",
2232+
be16_to_cpu(fdmi_cmd), latt, ulp_status,
2233+
ulp_word4, phba->sli.sli_flag);
22292234

22302235
/* Look for a retryable error */
22312236
if (ulp_status == IOSTAT_LOCAL_REJECT) {
@@ -2234,8 +2239,16 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
22342239
case IOERR_SLI_DOWN:
22352240
/* Driver aborted this IO. No retry as error
22362241
* is likely Offline->Online or some adapter
2237-
* error. Recovery will try again.
2242+
* error. Recovery will try again, but if port
2243+
* is not active there's no point to continue
2244+
* issuing follow up FDMI commands.
22382245
*/
2246+
if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) {
2247+
free_ndlp = cmdiocb->ndlp;
2248+
lpfc_ct_free_iocb(phba, cmdiocb);
2249+
lpfc_nlp_put(free_ndlp);
2250+
return;
2251+
}
22392252
break;
22402253
case IOERR_ABORT_IN_PROGRESS:
22412254
case IOERR_SEQUENCE_TIMEOUT:
@@ -2256,12 +2269,6 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
22562269
break;
22572270
}
22582271
}
2259-
2260-
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2261-
"0229 FDMI cmd %04x latt = %d "
2262-
"ulp_status: x%x, rid x%x\n",
2263-
be16_to_cpu(fdmi_cmd), latt, ulp_status,
2264-
ulp_word4);
22652272
}
22662273

22672274
free_ndlp = cmdiocb->ndlp;

0 commit comments

Comments
 (0)