aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_hbadisc.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2008-01-11 01:53:27 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-23 12:29:24 -0500
commitfa4066b672821d24cb7180b8d0434b01a7043172 (patch)
tree3a42b4c706b002a165c762f7a613052a0633903e /drivers/scsi/lpfc/lpfc_hbadisc.c
parentc95d6c6c2b0a303a113fd468efce7430d5b20eac (diff)
[SCSI] lpfc 8.2.4 : Rework misplaced reference taking on node structure
Rework misplaced reference taking on node structure Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_hbadisc.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 644d96012d56..dc042bd97baa 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -149,7 +149,10 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
149 return; 149 return;
150 150
151 spin_lock_irq(&phba->hbalock); 151 spin_lock_irq(&phba->hbalock);
152 evtp->evt_arg1 = ndlp; 152 /* We need to hold the node by incrementing the reference
153 * count until this queued work is done
154 */
155 evtp->evt_arg1 = lpfc_nlp_get(ndlp);
153 evtp->evt = LPFC_EVT_DEV_LOSS; 156 evtp->evt = LPFC_EVT_DEV_LOSS;
154 list_add_tail(&evtp->evt_listp, &phba->work_list); 157 list_add_tail(&evtp->evt_listp, &phba->work_list);
155 if (phba->work_wait) 158 if (phba->work_wait)
@@ -300,12 +303,18 @@ lpfc_work_list_done(struct lpfc_hba *phba)
300 ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1); 303 ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1);
301 lpfc_els_retry_delay_handler(ndlp); 304 lpfc_els_retry_delay_handler(ndlp);
302 free_evt = 0; /* evt is part of ndlp */ 305 free_evt = 0; /* evt is part of ndlp */
306 /* decrement the node reference count held
307 * for this queued work
308 */
309 lpfc_nlp_put(ndlp);
303 break; 310 break;
304 case LPFC_EVT_DEV_LOSS: 311 case LPFC_EVT_DEV_LOSS:
305 ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); 312 ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1);
306 lpfc_nlp_get(ndlp);
307 lpfc_dev_loss_tmo_handler(ndlp); 313 lpfc_dev_loss_tmo_handler(ndlp);
308 free_evt = 0; 314 free_evt = 0;
315 /* decrement the node reference count held for
316 * this queued work
317 */
309 lpfc_nlp_put(ndlp); 318 lpfc_nlp_put(ndlp);
310 break; 319 break;
311 case LPFC_EVT_ONLINE: 320 case LPFC_EVT_ONLINE:
@@ -1176,6 +1185,9 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1176 lpfc_mbuf_free(phba, mp->virt, mp->phys); 1185 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1177 kfree(mp); 1186 kfree(mp);
1178 mempool_free(pmb, phba->mbox_mem_pool); 1187 mempool_free(pmb, phba->mbox_mem_pool);
1188 /* decrement the node reference count held for this callback
1189 * function.
1190 */
1179 lpfc_nlp_put(ndlp); 1191 lpfc_nlp_put(ndlp);
1180 1192
1181 return; 1193 return;
@@ -1363,6 +1375,9 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1363 1375
1364 if (mb->mbxStatus) { 1376 if (mb->mbxStatus) {
1365out: 1377out:
1378 /* decrement the node reference count held for this
1379 * callback function.
1380 */
1366 lpfc_nlp_put(ndlp); 1381 lpfc_nlp_put(ndlp);
1367 lpfc_mbuf_free(phba, mp->virt, mp->phys); 1382 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1368 kfree(mp); 1383 kfree(mp);
@@ -1414,6 +1429,9 @@ out:
1414 goto out; 1429 goto out;
1415 } 1430 }
1416 1431
1432 /* decrement the node reference count held for this
1433 * callback function.
1434 */
1417 lpfc_nlp_put(ndlp); 1435 lpfc_nlp_put(ndlp);
1418 lpfc_mbuf_free(phba, mp->virt, mp->phys); 1436 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1419 kfree(mp); 1437 kfree(mp);
@@ -1661,13 +1679,14 @@ void
1661lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 1679lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1662{ 1680{
1663 /* 1681 /*
1664 * Use of lpfc_drop_node and UNUSED list. lpfc_drop_node should 1682 * Use of lpfc_drop_node and UNUSED list: lpfc_drop_node should
1665 * be used if we wish to issue the "last" lpfc_nlp_put() to remove 1683 * be used if we wish to issue the "last" lpfc_nlp_put() to remove
1666 * the ndlp from the vport. The ndlp resides on the UNUSED list 1684 * the ndlp from the vport. The ndlp marked as UNUSED on the list
1667 * until ALL other outstanding threads have completed. Thus, if a 1685 * until ALL other outstanding threads have completed. We check
1668 * ndlp is on the UNUSED list already, we should never do another 1686 * that the ndlp not already in the UNUSED state before we proceed.
1669 * lpfc_drop_node() on it.
1670 */ 1687 */
1688 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
1689 return;
1671 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE); 1690 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE);
1672 lpfc_nlp_put(ndlp); 1691 lpfc_nlp_put(ndlp);
1673 return; 1692 return;
@@ -2767,7 +2786,9 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
2767 else 2786 else
2768 mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); 2787 mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60);
2769 2788
2770 /* Mailbox took a reference to the node */ 2789 /* decrement the node reference count held for this callback
2790 * function.
2791 */
2771 lpfc_nlp_put(ndlp); 2792 lpfc_nlp_put(ndlp);
2772 lpfc_mbuf_free(phba, mp->virt, mp->phys); 2793 lpfc_mbuf_free(phba, mp->virt, mp->phys);
2773 kfree(mp); 2794 kfree(mp);