aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_els.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_els.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 0a5006ea9909..9315c3c2e6f6 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -2069,9 +2069,25 @@ int
2069lpfc_els_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *elsiocb) 2069lpfc_els_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *elsiocb)
2070{ 2070{
2071 struct lpfc_dmabuf *buf_ptr, *buf_ptr1; 2071 struct lpfc_dmabuf *buf_ptr, *buf_ptr1;
2072 struct lpfc_nodelist *ndlp;
2072 2073
2073 if (elsiocb->context1) { 2074 ndlp = (struct lpfc_nodelist *)elsiocb->context1;
2074 lpfc_nlp_put(elsiocb->context1); 2075 if (ndlp) {
2076 if (ndlp->nlp_flag & NLP_DEFER_RM) {
2077 lpfc_nlp_put(ndlp);
2078
2079 /* If the ndlp is not being used by another discovery
2080 * thread, free it.
2081 */
2082 if (!lpfc_nlp_not_used(ndlp)) {
2083 /* If ndlp is being used by another discovery
2084 * thread, just clear NLP_DEFER_RM
2085 */
2086 ndlp->nlp_flag &= ~NLP_DEFER_RM;
2087 }
2088 }
2089 else
2090 lpfc_nlp_put(ndlp);
2075 elsiocb->context1 = NULL; 2091 elsiocb->context1 = NULL;
2076 } 2092 }
2077 /* context2 = cmd, context2->next = rsp, context3 = bpl */ 2093 /* context2 = cmd, context2->next = rsp, context3 = bpl */
@@ -2130,13 +2146,15 @@ lpfc_mbx_cmpl_dflt_rpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
2130 lpfc_mbuf_free(phba, mp->virt, mp->phys); 2146 lpfc_mbuf_free(phba, mp->virt, mp->phys);
2131 kfree(mp); 2147 kfree(mp);
2132 mempool_free(pmb, phba->mbox_mem_pool); 2148 mempool_free(pmb, phba->mbox_mem_pool);
2133 lpfc_nlp_put(ndlp); 2149 if (ndlp) {
2150 lpfc_nlp_put(ndlp);
2134 2151
2135 /* This is the end of the default RPI cleanup logic for this 2152 /* This is the end of the default RPI cleanup logic for this
2136 * ndlp. If no other discovery threads are using this ndlp. 2153 * ndlp. If no other discovery threads are using this ndlp.
2137 * we should free all resources associated with it. 2154 * we should free all resources associated with it.
2138 */ 2155 */
2139 lpfc_nlp_not_used(ndlp); 2156 lpfc_nlp_not_used(ndlp);
2157 }
2140 return; 2158 return;
2141} 2159}
2142 2160