From 549e55cd2a1b83ea45ac17fb6c309654a3d371a4 Mon Sep 17 00:00:00 2001 From: James Smart Date: Thu, 2 Aug 2007 11:09:51 -0400 Subject: [SCSI] lpfc 8.2.2 : Fix locking around HBA's port_list Cleans up a lot of bad behaviors that have been in this area a while Signed-off-by: James Smart Signed-off-by: James Bottomley --- drivers/scsi/lpfc/lpfc_ct.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/scsi/lpfc/lpfc_ct.c') diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index edbebffa26c..43e2e33f9a0 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -390,17 +390,19 @@ lpfc_ct_cmd(struct lpfc_vport *vport, struct lpfc_dmabuf *inmp, return 0; } -static struct lpfc_vport * +struct lpfc_vport * lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) { - struct lpfc_vport *vport_curr; + unsigned long flags; + spin_lock_irqsave(&phba->hbalock, flags); list_for_each_entry(vport_curr, &phba->port_list, listentry) { - if ((vport_curr->fc_myDID) && - (vport_curr->fc_myDID == did)) + if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) { + spin_unlock_irqrestore(&phba->hbalock, flags); return vport_curr; + } } - + spin_unlock_irqrestore(&phba->hbalock, flags); return NULL; } -- cgit v1.2.3