Received: by 10.192.165.156 with SMTP id m28csp46801imm; Tue, 10 Apr 2018 16:05:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/8nXZxyZgq70d1Y/ZjH963gxL0hKNdPLukbkhRpfMwOXxQO/C6FVPZsYk7nHTAcaLnboX X-Received: by 10.99.36.7 with SMTP id k7mr1637342pgk.63.1523401556202; Tue, 10 Apr 2018 16:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401556; cv=none; d=google.com; s=arc-20160816; b=ZHReBESAD/ydvqWS3AsYqRHDLKybIDMCsRWndvDK+aJp4Qd3fYwoXlbVry2tNm4wX1 F5+RcYOE+FAna15yNrq5iImTg0kp2U8JYm9Vg8HlANHEgA8YjrGV8PdowQ8ErPVR6mub Y4GaEpTVsNki85usv9CXKWNE8rd341Vpp4756rPvBwX0lcEb/znMRNx2tATHH3r48tqy 6Raf8fJjTm9zfE3HSUpoHCZ5P1W3YwvNLGH7O19jfqlyAmPpU1pg12KOlATyh3pVoT9g s/dJEdgLy+q0xCWzt5QHAMFqrWN2zMtALiQVUAbq2dkF9UXJK1nvqMpUd0AYFmSgWPbR uFlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=UGkDYiOOpOelxj7AZg+76zPwMgtCNN2COgQcX+MeO6g=; b=ybTbOd82CUFdo3it4PsEBO6owBHyxwLRwvMtmTwTJs/8M+xbfOCA9eRHBW+i10yErc 13xvWgStXIjgsKrzOVnk0bLwYztMzoBGKHOOIG5MzRXLmMXjcED2KMRhB5iziC4VLM7Y 0X2sD0Q3G8qIVhj1iuaDwVaSzz+dt8UZSUZBYmhb1NkQIBgt1Jd551VOxQHNIhkkWBhU Udf7oC+O0vyug9c1M8jse4LxQMmr9SMod6pYb9Q5iR1vyvk4tmrIh9DAqZZkEiczLMrr S1u3tVr17nCIEK7jr2aMIE6lnmUA++2GSKWiveYXCKy4IblsziuFVzdD8XTNBsLQq6WI Pv8g== 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 w11si2408877pgq.333.2018.04.10.16.05.19; Tue, 10 Apr 2018 16:05:56 -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 S1755667AbeDJWgn (ORCPT + 99 others); Tue, 10 Apr 2018 18:36:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43184 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755650AbeDJWgl (ORCPT ); Tue, 10 Apr 2018 18:36:41 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1CAA1DFA; Tue, 10 Apr 2018 22:36:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, chenxiang , John Garry , Jason Yan , Christoph Hellwig , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 062/138] scsi: libsas: initialize sas_phy status according to response of DISCOVER Date: Wed, 11 Apr 2018 00:24:12 +0200 Message-Id: <20180410212909.329692446@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: chenxiang [ Upstream commit affc67788fe5dfffad5cda3d461db5cf2b2ff2b0 ] The status of SAS PHY is in sas_phy->enabled. There is an issue that the status of a remote SAS PHY may be initialized incorrectly: if disable remote SAS PHY through sysfs interface (such as echo 0 > /sys/class/sas_phy/phy-1:0:0/enable), then reboot the system, and we will find the status of remote SAS PHY which is disabled before is 1 (cat /sys/class/sas_phy/phy-1:0:0/enable). But actually the status of remote SAS PHY is disabled and the device attached is not found. In SAS protocol, NEGOTIATED LOGICAL LINK RATE field of DISCOVER response is 0x1 when remote SAS PHY is disabled. So initialize sas_phy->enabled according to the value of NEGOTIATED LOGICAL LINK RATE field. Signed-off-by: chenxiang Reviewed-by: John Garry Signed-off-by: Jason Yan Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/libsas/sas_expander.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -293,6 +293,7 @@ static void sas_set_ex_phy(struct domain phy->phy->minimum_linkrate = dr->pmin_linkrate; phy->phy->maximum_linkrate = dr->pmax_linkrate; phy->phy->negotiated_linkrate = phy->linkrate; + phy->phy->enabled = (phy->linkrate != SAS_PHY_DISABLED); skip: if (new_phy)