Commit 0630a1f7 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Add missing free iocb and nlp kref put for early return VMID cases

Sometimes VMID targets are not getting rediscovered after a port reset.

The iocb is not freed in lpfc_cmpl_ct_cmd_vmid(), which is the completion
function for the appid CT commands.  So after a port reset, the count of
sges is less than the expected count of 250.  This causes post reset
operation logic to fail and keep the port offline.

Fix by freeing the iocb and kref put for the lpfc_cmpl_ct_cmd_vmid() early
return cases.

Link: https://lore.kernel.org/r/20220911221505.117655-5-jsmart2021@gmail.comCo-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b873d103
...@@ -3909,6 +3909,7 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -3909,6 +3909,7 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
struct lpfc_sli_ct_request *ctrsp = outp->virt; struct lpfc_sli_ct_request *ctrsp = outp->virt;
u16 rsp = ctrsp->CommandResponse.bits.CmdRsp; u16 rsp = ctrsp->CommandResponse.bits.CmdRsp;
struct app_id_object *app; struct app_id_object *app;
struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
u32 cmd, hash, bucket; u32 cmd, hash, bucket;
struct lpfc_vmid *vmp, *cur; struct lpfc_vmid *vmp, *cur;
u8 *data = outp->virt; u8 *data = outp->virt;
...@@ -3920,7 +3921,7 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -3920,7 +3921,7 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
if (lpfc_els_chk_latt(vport) || get_job_ulpstatus(phba, rspiocb)) { if (lpfc_els_chk_latt(vport) || get_job_ulpstatus(phba, rspiocb)) {
if (cmd != SLI_CTAS_DALLAPP_ID) if (cmd != SLI_CTAS_DALLAPP_ID)
return; goto free_res;
} }
/* Check for a CT LS_RJT response */ /* Check for a CT LS_RJT response */
if (rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { if (rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) {
...@@ -3935,7 +3936,7 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -3935,7 +3936,7 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
/* If DALLAPP_ID failed retry later */ /* If DALLAPP_ID failed retry later */
if (cmd == SLI_CTAS_DALLAPP_ID) if (cmd == SLI_CTAS_DALLAPP_ID)
vport->load_flag |= FC_DEREGISTER_ALL_APP_ID; vport->load_flag |= FC_DEREGISTER_ALL_APP_ID;
return; goto free_res;
} }
} }
...@@ -3949,7 +3950,7 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -3949,7 +3950,7 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
app->obj.entity_id_len); app->obj.entity_id_len);
if (app->obj.entity_id_len == 0 || app->port_id == 0) if (app->obj.entity_id_len == 0 || app->port_id == 0)
return; goto free_res;
hash = lpfc_vmid_hash_fn(app->obj.entity_id, hash = lpfc_vmid_hash_fn(app->obj.entity_id,
app->obj.entity_id_len); app->obj.entity_id_len);
...@@ -3996,6 +3997,9 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -3996,6 +3997,9 @@ lpfc_cmpl_ct_cmd_vmid(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_DEBUG, LOG_DISCOVERY,
"8857 Invalid command code\n"); "8857 Invalid command code\n");
} }
free_res:
lpfc_ct_free_iocb(phba, cmdiocb);
lpfc_nlp_put(ndlp);
} }
/** /**
......
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