Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5626505imu; Wed, 30 Jan 2019 00:26:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN6qEzDhzrNvPuunNQJy6id+5K2yCXQYSKLibCWLBTeHEX73UpAXscYUDaPU3hwfNdNrkaMF X-Received: by 2002:a17:902:70c6:: with SMTP id l6mr23585536plt.30.1548836791055; Wed, 30 Jan 2019 00:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548836790; cv=none; d=google.com; s=arc-20160816; b=DTPS9sgb1aeAN16phgqhtKEJQLY5V3PaKfQrJb+lr3R7Cv/wdzofrDK46Biw6IAn5n 8uFuQ/0uoJ5PrwCiDpCc78FnPFv6zcsrzo8uDwVX293lbpMu5TyiNsvyElM4R7VJ0HLQ Jl1ZaEA67kR7l9wzixk0sbwXTT8tV9COM0NVBb3JzYt8e14LOVtgoCX7rkMsOb4/76Ld wmXj4t0f9jNJDFTrImzyC/6SXLEA+bG6nKQSzgZAuYI12+AAhbLwLbV1BLXKc2PzlJri A8BoKuh1o7JKX57+5b3uSdq1A0noYvKgYSgfVowzKTmUH8FP05xoPzpZikJrVHZFhlZj Q+gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ovNWuJhb73qSjyh6+cQcFcgcNiSKNtzYMPOU3sKHtX4=; b=qGhzV0ht9HLBdEoyWuRtFy8B1Gbnf+3xO5DWizIJyQa3uYFhoW2PH7jLls+0GWhF1T TpPMUeUKtq8a0sulSDGAFox2wWDeE+aeP9tf1gKuU3YRdXgyfW7f2Wl5WC+K6gBw6gHu MvO+AWWHG0gX/lfj/Ru18isNVACeEl6dP1abg0YPb/8fFbhlHzxa9oFqFGWW8NrUZZ92 u/RPWl2bsrY8B0pl6z01yxnSpNd/EZJ8KUdFYRG5MciWOMRFynKwOzSGUCRI3Cp0+5tN tCwBDXxLgEG26Z1jd18gC6e4SZhRE8ZmSvRGNHFquzSpkvQL1IywjTXstBgZbNM840ra DipQ== 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 t75si814824pfi.193.2019.01.30.00.26.16; Wed, 30 Jan 2019 00:26:30 -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 S1730360AbfA3I0E (ORCPT + 99 others); Wed, 30 Jan 2019 03:26:04 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2701 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725834AbfA3IZ6 (ORCPT ); Wed, 30 Jan 2019 03:25:58 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D39B661D8BCC729635C2; Wed, 30 Jan 2019 16:25:56 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Wed, 30 Jan 2019 16:25:50 +0800 From: Jason Yan To: , CC: , , , , , , , , , , , , , Jason Yan , Xiaofei Tan , Ewan Milne , Tomas Henzl Subject: [PATCH v2 6/7] scsi: libsas: reset the phy address if discover failed Date: Wed, 30 Jan 2019 16:24:11 +0800 Message-ID: <20190130082412.9357-7-yanaijie@huawei.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20190130082412.9357-1-yanaijie@huawei.com> References: <20190130082412.9357-1-yanaijie@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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; -- 2.14.4