@@ -1623,9 +1623,7 @@ static int pqi_get_physical_device_info(struct pqi_ctrl_info *ctrl_info,
16231623 & id_phys -> alternate_paths_phys_connector ,
16241624 sizeof (device -> phys_connector ));
16251625 device -> bay = id_phys -> phys_bay_in_box ;
1626- device -> multi_lun_device_lun_count = id_phys -> multi_lun_device_lun_count ;
1627- if (!device -> multi_lun_device_lun_count )
1628- device -> multi_lun_device_lun_count = 1 ;
1626+ device -> lun_count = id_phys -> multi_lun_device_lun_count ;
16291627 if ((id_phys -> even_more_flags & PQI_DEVICE_PHY_MAP_SUPPORTED ) &&
16301628 id_phys -> phy_count )
16311629 device -> phy_id =
@@ -1759,7 +1757,7 @@ static bool pqi_keep_device_offline(struct pqi_ctrl_info *ctrl_info,
17591757 return offline ;
17601758}
17611759
1762- static int pqi_get_device_info (struct pqi_ctrl_info * ctrl_info ,
1760+ static int pqi_get_device_info_phys_logical (struct pqi_ctrl_info * ctrl_info ,
17631761 struct pqi_scsi_dev * device ,
17641762 struct bmic_identify_physical_device * id_phys )
17651763{
@@ -1776,6 +1774,20 @@ static int pqi_get_device_info(struct pqi_ctrl_info *ctrl_info,
17761774 return rc ;
17771775}
17781776
1777+ static int pqi_get_device_info (struct pqi_ctrl_info * ctrl_info ,
1778+ struct pqi_scsi_dev * device ,
1779+ struct bmic_identify_physical_device * id_phys )
1780+ {
1781+ int rc ;
1782+
1783+ rc = pqi_get_device_info_phys_logical (ctrl_info , device , id_phys );
1784+
1785+ if (rc == 0 && device -> lun_count == 0 )
1786+ device -> lun_count = 1 ;
1787+
1788+ return rc ;
1789+ }
1790+
17791791static void pqi_show_volume_status (struct pqi_ctrl_info * ctrl_info ,
17801792 struct pqi_scsi_dev * device )
17811793{
@@ -1910,7 +1922,7 @@ static inline void pqi_remove_device(struct pqi_ctrl_info *ctrl_info, struct pqi
19101922 int rc ;
19111923 int lun ;
19121924
1913- for (lun = 0 ; lun < device -> multi_lun_device_lun_count ; lun ++ ) {
1925+ for (lun = 0 ; lun < device -> lun_count ; lun ++ ) {
19141926 rc = pqi_device_wait_for_pending_io (ctrl_info , device , lun ,
19151927 PQI_REMOVE_DEVICE_PENDING_IO_TIMEOUT_MSECS );
19161928 if (rc )
@@ -2089,6 +2101,7 @@ static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info,
20892101 existing_device -> sas_address = new_device -> sas_address ;
20902102 existing_device -> queue_depth = new_device -> queue_depth ;
20912103 existing_device -> device_offline = false;
2104+ existing_device -> lun_count = new_device -> lun_count ;
20922105
20932106 if (pqi_is_logical_device (existing_device )) {
20942107 existing_device -> is_external_raid_device = new_device -> is_external_raid_device ;
@@ -2121,10 +2134,6 @@ static void pqi_scsi_update_device(struct pqi_ctrl_info *ctrl_info,
21212134 existing_device -> phy_connected_dev_type = new_device -> phy_connected_dev_type ;
21222135 memcpy (existing_device -> box , new_device -> box , sizeof (existing_device -> box ));
21232136 memcpy (existing_device -> phys_connector , new_device -> phys_connector , sizeof (existing_device -> phys_connector ));
2124-
2125- existing_device -> multi_lun_device_lun_count = new_device -> multi_lun_device_lun_count ;
2126- if (existing_device -> multi_lun_device_lun_count == 0 )
2127- existing_device -> multi_lun_device_lun_count = 1 ;
21282137 }
21292138}
21302139
@@ -6502,6 +6511,12 @@ static void pqi_slave_destroy(struct scsi_device *sdev)
65026511 return ;
65036512 }
65046513
6514+ device -> lun_count -- ;
6515+ if (device -> lun_count > 0 ) {
6516+ mutex_unlock (& ctrl_info -> scan_mutex );
6517+ return ;
6518+ }
6519+
65056520 spin_lock_irqsave (& ctrl_info -> scsi_device_list_lock , flags );
65066521 list_del (& device -> scsi_device_list_entry );
65076522 spin_unlock_irqrestore (& ctrl_info -> scsi_device_list_lock , flags );
0 commit comments