[SCSI] lpfc 8.3.31: Fix bug with driver unload leaving a scsi host for a vport around
authorJames Smart <james.smart@emulex.com>
Thu, 10 May 2012 01:16:03 +0000 (21:16 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 17 May 2012 09:23:38 +0000 (10:23 +0100)
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/lpfc/lpfc_init.c

index 9598fdcb08ab0ee50b147574d05406eee286376e..5538cd06861159d96801b1f0384242f228465c4c 100644 (file)
@@ -8694,8 +8694,11 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev)
        /* Release all the vports against this physical port */
        vports = lpfc_create_vport_work_array(phba);
        if (vports != NULL)
-               for (i = 1; i <= phba->max_vports && vports[i] != NULL; i++)
+               for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
+                       if (vports[i]->port_type == LPFC_PHYSICAL_PORT)
+                               continue;
                        fc_vport_terminate(vports[i]->fc_vport);
+               }
        lpfc_destroy_vport_work_array(phba, vports);
 
        /* Remove FC host and then SCSI host with the physical port */
@@ -9455,8 +9458,11 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev)
        /* Release all the vports against this physical port */
        vports = lpfc_create_vport_work_array(phba);
        if (vports != NULL)
-               for (i = 1; i <= phba->max_vports && vports[i] != NULL; i++)
+               for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
+                       if (vports[i]->port_type == LPFC_PHYSICAL_PORT)
+                               continue;
                        fc_vport_terminate(vports[i]->fc_vport);
+               }
        lpfc_destroy_vport_work_array(phba, vports);
 
        /* Remove FC host and then SCSI host with the physical port */