aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_nportdisc.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2007-04-25 09:53:01 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-05-06 10:33:15 -0400
commit329f9bc735b4665d42267259b1612191f72c4d42 (patch)
treeb696a632e19afa0d0e42012efd7992690f69e1a1 /drivers/scsi/lpfc/lpfc_nportdisc.c
parent2680eeaaa03e83a87ece2724e71f7cc816cd3ef0 (diff)
[SCSI] lpfc 8.1.12 : Reference count node structures for node lifetime management
Reference count node structures for node lifetime management. Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_nportdisc.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 789a12dc986b..f03284ad25b7 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -353,7 +353,10 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,
353 * queue this mbox command to be processed later. 353 * queue this mbox command to be processed later.
354 */ 354 */
355 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; 355 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login;
356 mbox->context2 = ndlp; 356 /*
357 * mbox->context2 = lpfc_nlp_get(ndlp) deferred until mailbox
358 * command issued in lpfc_cmpl_els_acc().
359 */
357 ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); 360 ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI);
358 361
359 /* 362 /*
@@ -773,13 +776,14 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
773 default: 776 default:
774 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; 777 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login;
775 } 778 }
776 mbox->context2 = ndlp; 779 mbox->context2 = lpfc_nlp_get(ndlp);
777 if (lpfc_sli_issue_mbox(phba, mbox, 780 if (lpfc_sli_issue_mbox(phba, mbox,
778 (MBX_NOWAIT | MBX_STOP_IOCB)) 781 (MBX_NOWAIT | MBX_STOP_IOCB))
779 != MBX_NOT_FINISHED) { 782 != MBX_NOT_FINISHED) {
780 lpfc_nlp_set_state(phba, ndlp, NLP_STE_REG_LOGIN_ISSUE); 783 lpfc_nlp_set_state(phba, ndlp, NLP_STE_REG_LOGIN_ISSUE);
781 return ndlp->nlp_state; 784 return ndlp->nlp_state;
782 } 785 }
786 lpfc_nlp_put(ndlp);
783 mp = (struct lpfc_dmabuf *)mbox->context1; 787 mp = (struct lpfc_dmabuf *)mbox->context1;
784 lpfc_mbuf_free(phba, mp->virt, mp->phys); 788 lpfc_mbuf_free(phba, mp->virt, mp->phys);
785 kfree(mp); 789 kfree(mp);
@@ -1920,7 +1924,7 @@ lpfc_disc_state_machine(struct lpfc_hba * phba,
1920 uint32_t(*func) (struct lpfc_hba *, struct lpfc_nodelist *, void *, 1924 uint32_t(*func) (struct lpfc_hba *, struct lpfc_nodelist *, void *,
1921 uint32_t); 1925 uint32_t);
1922 1926
1923 ndlp->nlp_disc_refcnt++; 1927 lpfc_nlp_get(ndlp);
1924 cur_state = ndlp->nlp_state; 1928 cur_state = ndlp->nlp_state;
1925 1929
1926 /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ 1930 /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */
@@ -1943,18 +1947,7 @@ lpfc_disc_state_machine(struct lpfc_hba * phba,
1943 phba->brd_no, 1947 phba->brd_no,
1944 rc, ndlp->nlp_DID, ndlp->nlp_flag); 1948 rc, ndlp->nlp_DID, ndlp->nlp_flag);
1945 1949
1946 ndlp->nlp_disc_refcnt--; 1950 lpfc_nlp_put(ndlp);
1947 1951
1948 /* Check to see if ndlp removal is deferred */
1949 if ((ndlp->nlp_disc_refcnt == 0)
1950 && (ndlp->nlp_flag & NLP_DELAY_REMOVE)) {
1951 spin_lock_irq(phba->host->host_lock);
1952 ndlp->nlp_flag &= ~NLP_DELAY_REMOVE;
1953 spin_unlock_irq(phba->host->host_lock);
1954 lpfc_nlp_remove(phba, ndlp);
1955 return NLP_STE_FREED_NODE;
1956 }
1957 if (rc == NLP_STE_FREED_NODE)
1958 return NLP_STE_FREED_NODE;
1959 return rc; 1952 return rc;
1960} 1953}