Commit fa4066b6 authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.2.4 : Rework misplaced reference taking on node structure

Rework misplaced reference taking on node structure
Signed-off-by: default avatarJames Smart <James.Smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent c95d6c6c
...@@ -561,7 +561,6 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -561,7 +561,6 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
if (vport->load_flag & FC_UNLOADING) if (vport->load_flag & FC_UNLOADING)
goto out; goto out;
if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) { if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) {
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"0216 Link event during NS query\n"); "0216 Link event during NS query\n");
......
This diff is collapsed.
...@@ -149,7 +149,10 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) ...@@ -149,7 +149,10 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
return; return;
spin_lock_irq(&phba->hbalock); spin_lock_irq(&phba->hbalock);
evtp->evt_arg1 = ndlp; /* We need to hold the node by incrementing the reference
* count until this queued work is done
*/
evtp->evt_arg1 = lpfc_nlp_get(ndlp);
evtp->evt = LPFC_EVT_DEV_LOSS; evtp->evt = LPFC_EVT_DEV_LOSS;
list_add_tail(&evtp->evt_listp, &phba->work_list); list_add_tail(&evtp->evt_listp, &phba->work_list);
if (phba->work_wait) if (phba->work_wait)
...@@ -300,12 +303,18 @@ lpfc_work_list_done(struct lpfc_hba *phba) ...@@ -300,12 +303,18 @@ lpfc_work_list_done(struct lpfc_hba *phba)
ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1); ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1);
lpfc_els_retry_delay_handler(ndlp); lpfc_els_retry_delay_handler(ndlp);
free_evt = 0; /* evt is part of ndlp */ free_evt = 0; /* evt is part of ndlp */
/* decrement the node reference count held
* for this queued work
*/
lpfc_nlp_put(ndlp);
break; break;
case LPFC_EVT_DEV_LOSS: case LPFC_EVT_DEV_LOSS:
ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1);
lpfc_nlp_get(ndlp);
lpfc_dev_loss_tmo_handler(ndlp); lpfc_dev_loss_tmo_handler(ndlp);
free_evt = 0; free_evt = 0;
/* decrement the node reference count held for
* this queued work
*/
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
break; break;
case LPFC_EVT_ONLINE: case LPFC_EVT_ONLINE:
...@@ -1176,6 +1185,9 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -1176,6 +1185,9 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
lpfc_mbuf_free(phba, mp->virt, mp->phys); lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp); kfree(mp);
mempool_free(pmb, phba->mbox_mem_pool); mempool_free(pmb, phba->mbox_mem_pool);
/* decrement the node reference count held for this callback
* function.
*/
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
return; return;
...@@ -1363,6 +1375,9 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -1363,6 +1375,9 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
if (mb->mbxStatus) { if (mb->mbxStatus) {
out: out:
/* decrement the node reference count held for this
* callback function.
*/
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
lpfc_mbuf_free(phba, mp->virt, mp->phys); lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp); kfree(mp);
...@@ -1414,6 +1429,9 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -1414,6 +1429,9 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
goto out; goto out;
} }
/* decrement the node reference count held for this
* callback function.
*/
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
lpfc_mbuf_free(phba, mp->virt, mp->phys); lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp); kfree(mp);
...@@ -1661,13 +1679,14 @@ void ...@@ -1661,13 +1679,14 @@ void
lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
{ {
/* /*
* Use of lpfc_drop_node and UNUSED list. lpfc_drop_node should * Use of lpfc_drop_node and UNUSED list: lpfc_drop_node should
* be used if we wish to issue the "last" lpfc_nlp_put() to remove * be used if we wish to issue the "last" lpfc_nlp_put() to remove
* the ndlp from the vport. The ndlp resides on the UNUSED list * the ndlp from the vport. The ndlp marked as UNUSED on the list
* until ALL other outstanding threads have completed. Thus, if a * until ALL other outstanding threads have completed. We check
* ndlp is on the UNUSED list already, we should never do another * that the ndlp not already in the UNUSED state before we proceed.
* lpfc_drop_node() on it.
*/ */
if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
return;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
return; return;
...@@ -2767,7 +2786,9 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -2767,7 +2786,9 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
else else
mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60);
/* Mailbox took a reference to the node */ /* decrement the node reference count held for this callback
* function.
*/
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
lpfc_mbuf_free(phba, mp->virt, mp->phys); lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp); kfree(mp);
......
...@@ -922,6 +922,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, ...@@ -922,6 +922,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
NLP_STE_REG_LOGIN_ISSUE); NLP_STE_REG_LOGIN_ISSUE);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
/* decrement node reference count to the failed mbox
* command
*/
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
mp = (struct lpfc_dmabuf *) mbox->context1; mp = (struct lpfc_dmabuf *) mbox->context1;
lpfc_mbuf_free(phba, mp->virt, mp->phys); lpfc_mbuf_free(phba, mp->virt, mp->phys);
......
...@@ -2605,7 +2605,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) ...@@ -2605,7 +2605,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
"1806 Mbox x%x failed. No vport\n", "1806 Mbox x%x failed. No vport\n",
pmbox->mb.mbxCommand); pmbox->mb.mbxCommand);
dump_stack(); dump_stack();
return MBXERR_ERROR; return MBX_NOT_FINISHED;
} }
} }
......
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