lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180529022309.21071-7-yanaijie@huawei.com>
Date:   Tue, 29 May 2018 10:23:07 +0800
From:   Jason Yan <yanaijie@...wei.com>
To:     <martin.petersen@...cle.com>, <jejb@...ux.vnet.ibm.com>
CC:     <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <john.garry@...wei.com>, <zhaohongjiang@...wei.com>,
        <hare@...e.com>, <dan.j.williams@...el.com>, <jthumshirn@...e.de>,
        <hch@....de>, <huangdaode@...ilicon.com>,
        <chenxiang66@...ilicon.com>, <xiexiuqi@...wei.com>,
        <tj@...nel.org>, <miaoxie@...wei.com>,
        Jason Yan <yanaijie@...wei.com>,
        Xiaofei Tan <tanxiaofei@...wei.com>,
        Ewan Milne <emilne@...hat.com>, Tomas Henzl <thenzl@...hat.com>
Subject: [PATCH 6/8] scsi: libsas: reset the phy state and address if discover failed

When we failed to discover the device, the phy state and address is
still kept in ex_phy. So when the next time we revalidate this phy the
address and device type is the same, it will be considered as flutter
and will not be discovered again. So the device will not be brought up.

Fix this by reset the phy state and address to the initial value. Then
in the next revalidation the device will be discovered agian.

Signed-off-by: Jason Yan <yanaijie@...wei.com>
CC: Xiaofei Tan <tanxiaofei@...wei.com>
CC: John Garry <john.garry@...wei.com>
CC: Johannes Thumshirn <jthumshirn@...e.de>
CC: Ewan Milne <emilne@...hat.com>
CC: Christoph Hellwig <hch@....de>
CC: Tomas Henzl <thenzl@...hat.com>
CC: Dan Williams <dan.j.williams@...el.com>
CC: Hannes Reinecke <hare@...e.com>
---
 drivers/scsi/libsas/sas_expander.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 4617eccb0c43..6b6de85466c6 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -1107,6 +1107,15 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
 
 			}
 		}
+	} else {
+		/* if we failed to discover this device, we have to
+		 * reset the expander phy state and address so that we
+		 * will not treat the phy as flutter in the next
+		 * revalidation
+		 */
+		ex_phy->phy_state = PHY_VACANT;
+		ex_phy->attached_dev_type = SAS_PHY_UNUSED;
+		memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
 	}
 
 	return res;
-- 
2.13.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ