From: John Garry Subject: Re: [PATCH v2 6/7] scsi: libsas: reset the phy address if discover failed Date: Wed, 30 Jan 2019 17:36:20 +0000 Message-ID: References: <20190130082412.9357-1-yanaijie@huawei.com> <20190130082412.9357-7-yanaijie@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190130082412.9357-7-yanaijie@huawei.com> Sender: linux-kernel-owner@vger.kernel.org To: Jason Yan , martin.petersen@oracle.com, jejb@linux.vnet.ibm.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, zhaohongjiang@huawei.com, hare@suse.com, dan.j.williams@intel.com, jthumshirn@suse.de, hch@lst.de, huangdaode@hisilicon.com, chenxiang66@hisilicon.com, xiexiuqi@huawei.com, tj@kernel.org, miaoxie@huawei.com, Xiaofei Tan , Ewan Milne , Tomas Henzl List-Id: linux-scsi@vger.kernel.org On 30/01/2019 08:24, Jason Yan wrote: > When we failed to discover the device, the phy 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 address to the initial value. Then > in the next revalidation the device will be discovered agian. Why fail to discover the device? I wonder in which scenario you have seen this, such that it is worth rediscovery. > > Tested-by: Chen Liangfei > Signed-off-by: Jason Yan > CC: Xiaofei Tan > CC: John Garry > CC: Johannes Thumshirn > CC: Ewan Milne > CC: Christoph Hellwig > CC: Tomas Henzl > CC: Dan Williams > CC: Hannes Reinecke > --- > drivers/scsi/libsas/sas_expander.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c > index 6e56ebdc2148..e781941a7088 100644 > --- a/drivers/scsi/libsas/sas_expander.c > +++ b/drivers/scsi/libsas/sas_expander.c > @@ -1100,6 +1100,13 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id) > i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr)); > } > } > + } else { > + /* if we failed to discover this device, we have to > + * reset the expander phy attached address so that we > + * will not treat the phy as flutter in the next > + * revalidation > + */ > + memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE); > } > > return res; >