Re: [PATCH v6 2/2] scsi: libsas: Add linkrate and sas_addr change detection in rediscover
From: yangxingui
Date: Wed Jun 10 2026 - 21:34:51 EST
On 2026/6/10 17:37, John Garry wrote:
On 03/06/2026 10:21, Xingui Yang wrote:
+ return false;
+ } else if (SAS_ADDR(child_dev->sas_addr) != SAS_ADDR(phy->attached_sas_addr)) {
+ pr_info("ex %016llx phy%02d sas_addr changed from %016llx to %016llx\n",
+ SAS_ADDR(dev->sas_addr), phy_id,
+ SAS_ADDR(child_dev->sas_addr),
+ SAS_ADDR(phy->attached_sas_addr));
+ memcpy(phy->attached_sas_addr, child_dev->sas_addr, SAS_ADDR_SIZE);
can you comment in the code why you are going this?
Good point. I will add a comment explaining the reason.
sas_ex_phy_discover() has already updated phy->attached_sas_addr to the
new address discovered from the expander. However, sas_unregister_devs_sas_addr()
matches devices by comparing child->sas_addr with phy->attached_sas_addr
via sas_phy_match_dev_addr(). So we need to restore phy->attached_sas_addr
to the old device's address for proper matching.
I will update in next version.
Thanks,
Xingui