Skip to content

Commit 06036a0

Browse files
Xingui Yangmartinkpetersen
authored andcommitted
scsi: libsas: Fix the failure of adding phy with zero-address to port
As of commit 7d1d865 ("[SCSI] libsas: fix false positive 'device attached' conditions"), reset the phy->entacted_sas_addr address to a zero-address when the link rate is less than 1.5G. Currently we find that when a new device is attached, and the link rate is less than 1.5G, but the device type is not NO_DEVICE, for example: the link rate is SAS_PHY_RESET_IN_PROGRESS and the device type is stp. After setting the phy->entacted_sas_addr address to the zero address, the port will continue to be created for the phy with the zero-address, and other phys with the zero-address will be tried to be added to the new port: [562240.051197] sas: ex 500e004aaaaaaa1f phy19:U:0 attached: 0000000000000000 (no device) // phy19 is deleted but still on the parent port's phy_list [562240.062536] sas: ex 500e004aaaaaaa1f phy0 new device attached [562240.062616] sas: ex 500e004aaaaaaa1f phy00:U:5 attached: 0000000000000000 (stp) [562240.062680] port-7:7:0: trying to add phy phy-7:7:19 fails: it's already part of another port Therefore, it should be the same as sas_get_phy_attached_dev(). Only when device_type is SAS_PHY_UNUSED, sas_address is set to the 0 address. Fixes: 7d1d865 ("[SCSI] libsas: fix false positive 'device attached' conditions") Signed-off-by: Xingui Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 7a165a8 commit 06036a0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/scsi/libsas/sas_expander.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
261261
/* help some expanders that fail to zero sas_address in the 'no
262262
* device' case
263263
*/
264-
if (phy->attached_dev_type == SAS_PHY_UNUSED ||
265-
phy->linkrate < SAS_LINK_RATE_1_5_GBPS)
264+
if (phy->attached_dev_type == SAS_PHY_UNUSED)
266265
memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
267266
else
268267
memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE);

0 commit comments

Comments
 (0)