aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2014-04-04 13:51:44 -0400
committerChristoph Hellwig <hch@lst.de>2014-06-02 12:28:39 -0400
commit07eab624e5cf471450ed7b8c4ba8521e910dc9cf (patch)
treee9783c2eac57bca706fee652a4a35b5a1e15e3f3 /drivers/scsi/lpfc
parentbcece5f557d533a85b24cf4f4416c821219fb7b7 (diff)
lpfc: Fix locking for postbufq when freeing
Fix locking for postbufq when freeing Signed-off-by: James Smart <james.smart@emulex.com> Reviewed-By: Dick Kennedy <dick.kennedy@emulex.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index b2671dd520db..512f91ed5d25 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -836,19 +836,28 @@ lpfc_hba_free_post_buf(struct lpfc_hba *phba)
836 struct lpfc_sli *psli = &phba->sli; 836 struct lpfc_sli *psli = &phba->sli;
837 struct lpfc_sli_ring *pring; 837 struct lpfc_sli_ring *pring;
838 struct lpfc_dmabuf *mp, *next_mp; 838 struct lpfc_dmabuf *mp, *next_mp;
839 LIST_HEAD(buflist);
840 int count;
839 841
840 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) 842 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)
841 lpfc_sli_hbqbuf_free_all(phba); 843 lpfc_sli_hbqbuf_free_all(phba);
842 else { 844 else {
843 /* Cleanup preposted buffers on the ELS ring */ 845 /* Cleanup preposted buffers on the ELS ring */
844 spin_lock_irq(&phba->hbalock);
845 pring = &psli->ring[LPFC_ELS_RING]; 846 pring = &psli->ring[LPFC_ELS_RING];
846 list_for_each_entry_safe(mp, next_mp, &pring->postbufq, list) { 847 spin_lock_irq(&phba->hbalock);
848 list_splice_init(&pring->postbufq, &buflist);
849 spin_unlock_irq(&phba->hbalock);
850
851 count = 0;
852 list_for_each_entry_safe(mp, next_mp, &buflist, list) {
847 list_del(&mp->list); 853 list_del(&mp->list);
848 pring->postbufq_cnt--; 854 count++;
849 lpfc_mbuf_free(phba, mp->virt, mp->phys); 855 lpfc_mbuf_free(phba, mp->virt, mp->phys);
850 kfree(mp); 856 kfree(mp);
851 } 857 }
858
859 spin_lock_irq(&phba->hbalock);
860 pring->postbufq_cnt -= count;
852 spin_unlock_irq(&phba->hbalock); 861 spin_unlock_irq(&phba->hbalock);
853 } 862 }
854} 863}