]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/scsi-libsas-do-discovery-on-empty-phy-to-update-phy-.patch
drop rdma-cma-consider-scope_id-while-binding-to-ipv6-ll-.patch from 4.4, 4.9, and...
[thirdparty/kernel/stable-queue.git] / queue-4.4 / scsi-libsas-do-discovery-on-empty-phy-to-update-phy-.patch
CommitLineData
1143c684
SL
1From b7b72a33e073279bcf55cc1d3a0f8550cd9d093b Mon Sep 17 00:00:00 2001
2From: John Garry <john.garry@huawei.com>
3Date: Fri, 12 Apr 2019 16:57:56 +0800
4Subject: scsi: libsas: Do discovery on empty PHY to update PHY info
5
6[ Upstream commit d8649fc1c5e40e691d589ed825998c36a947491c ]
7
8When we discover the PHY is empty in sas_rediscover_dev(), the PHY
9information (like negotiated linkrate) is not updated.
10
11As such, for a user examining sysfs for that PHY, they would see
12incorrect values:
13
14root@(none)$ cd /sys/class/sas_phy/phy-0:0:20
15root@(none)$ more negotiated_linkrate
163.0 Gbit
17root@(none)$ echo 0 > enable
18root@(none)$ more negotiated_linkrate
193.0 Gbit
20
21So fix this, simply discover the PHY again, even though we know it's empty;
22in the above example, this gives us:
23
24root@(none)$ more negotiated_linkrate
25Phy disabled
26
27We must do this after unregistering the device associated with the PHY
28(in sas_unregister_devs_sas_addr()).
29
30Signed-off-by: John Garry <john.garry@huawei.com>
31Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
32Signed-off-by: Sasha Levin <sashal@kernel.org>
33---
34 drivers/scsi/libsas/sas_expander.c | 5 +++++
35 1 file changed, 5 insertions(+)
36
37diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
38index 1a6f65db615e8..ee1f9ee995e53 100644
39--- a/drivers/scsi/libsas/sas_expander.c
40+++ b/drivers/scsi/libsas/sas_expander.c
41@@ -2027,6 +2027,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
42 if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
43 phy->phy_state = PHY_EMPTY;
44 sas_unregister_devs_sas_addr(dev, phy_id, last);
45+ /*
46+ * Even though the PHY is empty, for convenience we discover
47+ * the PHY to update the PHY info, like negotiated linkrate.
48+ */
49+ sas_ex_phy_discover(dev, phy_id);
50 return res;
51 } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) &&
52 dev_type_flutter(type, phy->attached_dev_type)) {
53--
542.20.1
55