From: John Garry <john.g.garry@oracle.com>
To: yangxingui <yangxingui@huawei.com>,
yanaijie@huawei.com, jejb@linux.ibm.com,
martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxarm@huawei.com, liyihang9@h-partners.com,
liuyonglong@huawei.com, kangfenglong@huawei.com
Subject: Re: [PATCH v3 2/2] scsi: libsas: Add linkrate and sas_addr change detection in rediscover
Date: Wed, 27 May 2026 10:42:34 +0100 [thread overview]
Message-ID: <0a0f7284-8c11-4976-9377-d2fe9e0cf147@oracle.com> (raw)
In-Reply-To: <be627116-acd2-c9c5-a665-b86e4f6392c5@huawei.com>
On 25/05/2026 03:25, yangxingui wrote:
>>>
>>> Hi, John
>>> As the commit log. The existing pattern (unregister +
>>> sas_discover_new) handles the "replace" case where the SAS address
>>> changes completely, implying a different device.
>>> For the flutter case where we detect linkrate/sas_addr changes,
>>
>> Can you please clarify this: you say that the existing pattern handles
>> "replace" case where the SAS address changes completely, and then
>> flutter case covers sas_addr changes.
>>
>> What is the difference in the SAS address changes between the two cases?
>>
> Hi, John
>
> The difference is in when the SAS address change is detected:
> Replace case:
> - Detected immediately by the initial SMP DISCOVER response
> - New SAS address differs from stored phy->attached_sas_addr
>
> Flutter case:
> - Initial SMP DISCOVER shows SAS address matching stored phy-
> >attached_sas_addr
> - Linkrate may change
> - After sas_ex_phy_discover() refreshes phy info, child device address
> and linkrate may mismatched with refreshed phy info
>
> Additional issue with Replace flow:
> The existing replace code path also suffers from the same sysfs_warn_dup
> issue I mentioned earlier. sas_unregister_devs_sas_addr() only marks the
> device as gone and adds it to destroy_list. The actual sysfs cleanup
> happens later in sas_destruct_devices(). Calling sas_discover_new()
> immediately after unregister causes sysfs duplicate directory errors.
>
So can you actually recreate this issue? Or is it just theoretical?
About this following code:
+ if (need_rediscover) {
+ set_bit(SAS_DEV_GONE, &child_dev->state);
+ phy->phy_change_count = -1;
+ ex->ex_change_count = -1;
+ sas_unregister_devs_sas_addr(dev, phy_id, true);
+ sas_discover_event(dev->port, DISCE_REVALIDATE_DOMAIN);
+ } else {
Can we factor it out with other code? AFAICR, this can pattern can be
seen elsewhere.
Thanks
> We need to optimize the replace process.
next prev parent reply other threads:[~2026-05-27 9:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 8:45 [PATCH v3 0/2] libsas: rediscover improvements for linkrate/sas_addr changes Xingui Yang
2026-05-15 8:45 ` [PATCH v3 1/2] scsi: libsas: refactor sas_ex_to_ata() using new helper sas_ex_to_dev() Xingui Yang
2026-05-21 8:04 ` John Garry
2026-05-15 8:45 ` [PATCH v3 2/2] scsi: libsas: Add linkrate and sas_addr change detection in rediscover Xingui Yang
2026-05-21 8:13 ` John Garry
2026-05-21 9:04 ` yangxingui
2026-05-22 9:16 ` John Garry
2026-05-25 2:25 ` yangxingui
2026-05-27 9:42 ` John Garry [this message]
2026-05-28 2:40 ` yangxingui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0a0f7284-8c11-4976-9377-d2fe9e0cf147@oracle.com \
--to=john.g.garry@oracle.com \
--cc=jejb@linux.ibm.com \
--cc=kangfenglong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=liyihang9@h-partners.com \
--cc=martin.petersen@oracle.com \
--cc=yanaijie@huawei.com \
--cc=yangxingui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®