scsi: mpt3sas: Only one vSES is present even when IOC has multi vSES
authorSreekanth Reddy <sreekanth.reddy@broadcom.com>
Tue, 30 Mar 2021 10:50:04 +0000 (16:20 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 6 Apr 2021 03:29:56 +0000 (23:29 -0400)
Whenever the driver is adding a vSES to virtual-phys list it is
reinitializing the list head. Hence those vSES devices which were added
previously are lost.

Stop reinitializing the list every time a new vSES device is added.

Link: https://lore.kernel.org/r/20210330105004.20413-1-sreekanth.reddy@broadcom.com
Cc: stable@vger.kernel.org #v5.11.10+
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_scsih.c

index ffa7522cbb40467413977672750d1d39061007a5..3c5160f0137b34b875739d4875b6b3fdad9f0507 100644 (file)
@@ -6484,6 +6484,9 @@ _scsih_alloc_vphy(struct MPT3SAS_ADAPTER *ioc, u8 port_id, u8 phy_num)
                if (!vphy)
                        return NULL;
 
+               if (!port->vphys_mask)
+                       INIT_LIST_HEAD(&port->vphys_list);
+
                /*
                 * Enable bit corresponding to HBA phy number on its
                 * parent hba_port object's vphys_mask field.
@@ -6491,7 +6494,6 @@ _scsih_alloc_vphy(struct MPT3SAS_ADAPTER *ioc, u8 port_id, u8 phy_num)
                port->vphys_mask |= (1 << phy_num);
                vphy->phy_mask |= (1 << phy_num);
 
-               INIT_LIST_HEAD(&port->vphys_list);
                list_add_tail(&vphy->list, &port->vphys_list);
 
                ioc_info(ioc,