Skip to content

Commit ab2068a

Browse files
Xingui Yangmartinkpetersen
authored andcommitted
scsi: libsas: Fix exp-attached device scan after probe failure scanned in again after probe failed
The expander phy will be treated as broadcast flutter in the next revalidation after the exp-attached end device probe failed, as follows: [78779.654026] sas: broadcast received: 0 [78779.654037] sas: REVALIDATING DOMAIN on port 0, pid:10 [78779.654680] sas: ex 500e004aaaaaaa1f phy05 change count has changed [78779.662977] sas: ex 500e004aaaaaaa1f phy05 originated BROADCAST(CHANGE) [78779.662986] sas: ex 500e004aaaaaaa1f phy05 new device attached [78779.663079] sas: ex 500e004aaaaaaa1f phy05:U:8 attached: 500e004aaaaaaa05 (stp) [78779.693542] hisi_sas_v3_hw 0000:b4:02.0: dev[16:5] found [78779.701155] sas: done REVALIDATING DOMAIN on port 0, pid:10, res 0x0 [78779.707864] sas: Enter sas_scsi_recover_host busy: 0 failed: 0 ... [78835.161307] sas: --- Exit sas_scsi_recover_host: busy: 0 failed: 0 tries: 1 [78835.171344] sas: sas_probe_sata: for exp-attached device 500e004aaaaaaa05 returned -19 [78835.180879] hisi_sas_v3_hw 0000:b4:02.0: dev[16:5] is gone [78835.187487] sas: broadcast received: 0 [78835.187504] sas: REVALIDATING DOMAIN on port 0, pid:10 [78835.188263] sas: ex 500e004aaaaaaa1f phy05 change count has changed [78835.195870] sas: ex 500e004aaaaaaa1f phy05 originated BROADCAST(CHANGE) [78835.195875] sas: ex 500e004aaaaaaa1f rediscovering phy05 [78835.196022] sas: ex 500e004aaaaaaa1f phy05:U:A attached: 500e004aaaaaaa05 (stp) [78835.196026] sas: ex 500e004aaaaaaa1f phy05 broadcast flutter [78835.197615] sas: done REVALIDATING DOMAIN on port 0, pid:10, res 0x0 The cause of the problem is that the related ex_phy's attached_sas_addr was not cleared after the end device probe failed, so reset it. Signed-off-by: Xingui Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent b402a0d commit ab2068a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/scsi/libsas/sas_internal.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@ static inline void sas_fail_probe(struct domain_device *dev, const char *func, i
145145
func, dev->parent ? "exp-attached" :
146146
"direct-attached",
147147
SAS_ADDR(dev->sas_addr), err);
148+
149+
/*
150+
* If the device probe failed, the expander phy attached address
151+
* needs to be reset so that the phy will not be treated as flutter
152+
* in the next revalidation
153+
*/
154+
if (dev->parent && !dev_is_expander(dev->dev_type)) {
155+
struct sas_phy *phy = dev->phy;
156+
struct domain_device *parent = dev->parent;
157+
struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number];
158+
159+
memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
160+
}
161+
148162
sas_unregister_dev(dev->port, dev);
149163
}
150164

0 commit comments

Comments
 (0)