Received: by 10.192.165.156 with SMTP id m28csp64400imm; Tue, 10 Apr 2018 16:29:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx496x89xxA1GHhGGZMBYwPpX7NH87OCNo+xrnPZAVmEzIFxRO/V23JGfdxr68dNXAzItdT0I X-Received: by 10.98.141.78 with SMTP id z75mr1990350pfd.174.1523402994220; Tue, 10 Apr 2018 16:29:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402994; cv=none; d=google.com; s=arc-20160816; b=OZyIIVoO7+NnyeD+yc/nAgoCIMQyLdjSwR4E1knkBIS8MXpUbJHpbsa/3EWANHOJym Vb49U9bUeT3RfO1YFXqDFkQTaTMTY/9rDV5y+YAPScWdAdRoL3DsXKcfZh8HWU+/vf5o vLrRVUoiagttq04gw18JtsP7L6oOSXI5ocp3iceT/cMazaXgdPVzdV0ngYbBZfOZY8j5 6n6zY9cK+5VKMWh3e2V9R5wYnC/sks4uwS2vcWcJHmMhaJx4/0h1YvyHi+eea9Savdh+ bDeI0+P1y666SvwPTxAwHiY7ROMsaXyqeq1Gw4G6tpU0cSshD67sw5yd5hmq0tv90ZSC OiaA== 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=byN9pi43cbimSYFLJQpFlsRfEOtOD/YUYWmPa08vpmo=; b=guH9q3hSuSObJnOY+c/v9EcRYcgEm6xp5hxoyux/F/aCgCBtFqJ9Qc1YV8RqzkkXQ0 WQaUMOYsXYh1P5Qhk/dX+GP4WhAK765/xDvgYJhMnNDmfcQ5OJqwS14Elf7CtR3LMrNo JsqRELjdxuT8EqfKbkPFgMXpcAvZaOIBULdiHEMsXuuj1u2OSRwtRrF0J8hjLIbEw1u+ fAL55tMabZnKGGRBso0izhwPerdEV743aINjrFTOU40RkqF5UpxZm8VtA7BR7wWnaRCc Dynha8sk6wXgsa2Q6+4HtZb65iCse7FGhNgu2yNVw7zc7EgLoCQ+PYFqfXv0mZt8v6V7 4e9w== 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 c3si2394762pgu.785.2018.04.10.16.29.17; Tue, 10 Apr 2018 16:29:54 -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 S1754517AbeDJWaP (ORCPT + 99 others); Tue, 10 Apr 2018 18:30:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39894 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754428AbeDJWaN (ORCPT ); Tue, 10 Apr 2018 18:30:13 -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 590F5D4F; Tue, 10 Apr 2018 22:30:12 +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.15 079/168] scsi: libsas: initialize sas_phy status according to response of DISCOVER Date: Wed, 11 Apr 2018 00:23:41 +0200 Message-Id: <20180410212803.646678759@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-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)