Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6151295imu; Wed, 30 Jan 2019 09:37:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN5qYKpuq1HteNaO6CgrFt9WQIKQ6LZBn5yXEg3SttL/6aviZ809iNCkVz39X984Mxfraqe1 X-Received: by 2002:a63:9843:: with SMTP id l3mr28196531pgo.413.1548869848403; Wed, 30 Jan 2019 09:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548869848; cv=none; d=google.com; s=arc-20160816; b=X2+OzG+fOQPB71K6jfjJFDAneeFIQaK9ev5xBzknher+cavTpFypuNf36QQn/x+iSX fdR9aM9TPgYdQHkVyu9Bt7AttT27MPFy38aYGUnH/jyoQ10ZWF/HxpjhJoBmdqD0VRq7 59pRkXOKLBKWfXz6Nj1d/DH9YNLpb7FpYKjgo+HA6PJxhG1RINuDzk4CdP9GcbBc7U43 E5sg2lc1oqmAS1MMWkVhs70XMvVumgH3s7b65sTSVh9K2wx/mftB37Oq+8+BT2HDrN3a EgJbo/G178oN83Oy3QAQi2xFDrlwbFkTD7biWEOuhycu2NXkal9xLDWJHxfP8IOsSpg7 uWdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=3UEhRaWSa2uBvSl54iVjusT0q5R5eRftZCeE8K2sBKQ=; b=U0EUm1cf7FpgmPDh03HpLRqOTCb3SuikOnqMJsNU9nRB6uAh3ziidisPQhBbVXawLG tPTGudiPQElt3w0dkFTls9xZGM3CRVE72hJis79YFs523KMHLsKYHmQayNaG7QvKa3Vu 4ZnGS9L15j3X275F7G/QNSYkBtcFgbPFTKZ7gVJ5CcZRI3V6agLHNhk0r6f2ProC0C6F xtj7y1mvZOZgSWJJ/EJgoQqXwBc8BdVFrg8XT6AV75uiYuPZVEfhFz1SqltF/VUlTAlV bZNSGoi6jvIaNSAOqzIZoO0eUPDnpPaIIgSEQR3/0p25b8nhJ9T0zlrW3B/vGWoa0M0s ZbxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u72si1972382pgc.360.2019.01.30.09.37.04; Wed, 30 Jan 2019 09:37:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732462AbfA3Rgk (ORCPT + 99 others); Wed, 30 Jan 2019 12:36:40 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:45750 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726341AbfA3Rgk (ORCPT ); Wed, 30 Jan 2019 12:36:40 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0ED39E9CA0EE24673DC3; Thu, 31 Jan 2019 01:36:38 +0800 (CST) Received: from [127.0.0.1] (10.202.226.43) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Thu, 31 Jan 2019 01:36:29 +0800 Subject: Re: [PATCH v2 6/7] scsi: libsas: reset the phy address if discover failed To: Jason Yan , , References: <20190130082412.9357-1-yanaijie@huawei.com> <20190130082412.9357-7-yanaijie@huawei.com> CC: , , , , , , , , , , , , Xiaofei Tan , Ewan Milne , Tomas Henzl From: John Garry Message-ID: Date: Wed, 30 Jan 2019 17:36:20 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20190130082412.9357-7-yanaijie@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.43] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; >