Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2962698imm; Mon, 28 May 2018 21:03:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZorUhMSuCDi8u0+yOhRajGFwbck8HztY0kteRZSiF4T1EDjdg+8+FKH4RuAg42QgmN5V2xj X-Received: by 2002:a17:902:2983:: with SMTP id h3-v6mr16118820plb.232.1527566632678; Mon, 28 May 2018 21:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527566632; cv=none; d=google.com; s=arc-20160816; b=BMeOgnArBJDV3wCUXDRSikc+rJSUvdF8e5D3rwu+gWrRDysVXlUs8VdCQtEHV3OG79 1LwkowCJdr72WdCMDp1fYy2Y7yXrK+1dKxI/d+punL/DngQ04J8i4344F6SJAOgO+68y /kJlgM5TkPYdNxOZYIs1NFC+ke2/weRZUWo6Z3lWOZZL4XvdDxxPXQPJIE8MXsL3d8t8 Na6QhzvnZRNZoaVkh3IIBItH4/MG0tBqVXEQNgOWJUmH9SgP3ZybCxS/edFwVXWQLYvX zzSvAJzbz6ce91QIpV707mzdQdq2qmm7ny65LCAlM4SxKCDyeS3RheaXMxHIPOqVAert +KIw== 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:arc-authentication-results; bh=1R53otB/5sPbOWj/7f66G2nHvUB5ugc9BGvlfENY/k4=; b=wKd58IX5EHabPwBH+YK/JpzQ66STgjtpGoUYqZmIjsB9MA0sUghAShxs78xsHHQi6T QPwcuBnryxEQBE9kzUhfJ+BaRCO7ereeBLwWR69xDV3Cix1xaRnun/PInlogjBfHR9Mm rhvaU47m64f1EsZ203S389eOpnIxQNT5PxWX2oeAqKQjAsagIUpe3sp7X9Qzxr3aPY+f AwBVDqr7lTj+IluJHu9y+oIThvbh5pMwNJb9nlo5Xk6ymqztX+Zp3tUWovPHk95uxfiG 69kHF/7py2IsPy9/y9fBAdH3b3Uv8t/3lUyeeN5dkKYZ7j6aHitEpNgB8J/xpJjQjKoL +vXg== 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 w16-v6si31640277plq.141.2018.05.28.21.03.38; Mon, 28 May 2018 21:03:52 -0700 (PDT) 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 S1756017AbeE2COT (ORCPT + 99 others); Mon, 28 May 2018 22:14:19 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51316 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755996AbeE2COQ (ORCPT ); Mon, 28 May 2018 22:14:16 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B12103BB35846; Tue, 29 May 2018 10:14:12 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Tue, 29 May 2018 10:14:05 +0800 From: Jason Yan To: , CC: , , , , , , , , , , , , , Jason Yan , Xiaofei Tan , Ewan Milne , Tomas Henzl Subject: [PATCH 6/8] scsi: libsas: reset the phy state and address if discover failed Date: Tue, 29 May 2018 10:23:07 +0800 Message-ID: <20180529022309.21071-7-yanaijie@huawei.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180529022309.21071-1-yanaijie@huawei.com> References: <20180529022309.21071-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 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 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 | 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