Received: by 10.192.165.156 with SMTP id m28csp1159451imm; Wed, 11 Apr 2018 13:34:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+jXX0PmG0G+rpwqiraXcZHHV9iMXw6FBYPgDUkHLZTDx/YI4g6sfO1WN2YDol7EJ3GRmV/ X-Received: by 2002:a17:902:207:: with SMTP id 7-v6mr6739690plc.261.1523478874539; Wed, 11 Apr 2018 13:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523478874; cv=none; d=google.com; s=arc-20160816; b=IdNUQHl9zuLzOW5oMmn++1ZZRkGg4YI1QjEXX9kxvRy+JVx4Ne2bKPZKFmNDDGg0Dy FNwA2d/4EjfduasyeLdI7/2ALsN38PsQ/Z/yyGrPjm3w8LfAJ3UmrvnOdItPBr2PQWRU b7SbKpvKrZknFqvNtxFAZIX0VBs+nQ3WTyBb7w24UR5ezQ0v7j8XusHK8ucCYTeiAQDL 9CCkl5GKGQpZiqJTwiZ2sIMOZh4l2GysbhcRE0Fvygmnr2qoCPdIHWxkff8wfSa95mOl cL9+PYFr4H318g9gsMmodkPgDuCp34iSN5EgA/mkTqFI5b47q3+Y5MVIedcKS2qsQN/T 743w== 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=ZEvmEU+vdHWVxmIORG2czB0Wv5sopYvBW9COL8qv0tM=; b=m46yOV2+n6ql8LixH/NLaZHpx3+6fDm42LBJ5UFKO9kZkKO5GIGPgmQNDtFLa1k97H EfFxwH9Gv60/yrReIGd95wSpe0Q6Ky+xkE9by+8weC0JP8vxDjzbizxTP5pwA4o0qOqX DcovMPM4lVpImZZLovpDKia7rr9B1I2X+6+3fCkdS1YmcGMsdLmcrAsD9Pa9LLL5Un/m fZbrzYGgXFCzoqJ0uwecZJZge4wfDMD06U9bKaodvi0nmFPDSl1TCVZFzSVrmH0KArea XYJOQNAQTn3ZkXNLAotrzDN9jTeenRk3ezQVdsQ+iASUFL0wGKHngS6XVKB1sZn02h/+ ZLHg== 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 m12si1194598pga.698.2018.04.11.13.33.57; Wed, 11 Apr 2018 13:34:34 -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 S1756928AbeDKU2u (ORCPT + 99 others); Wed, 11 Apr 2018 16:28:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60786 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932632AbeDKSuY (ORCPT ); Wed, 11 Apr 2018 14:50:24 -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 BE269D82; Wed, 11 Apr 2018 18:50:23 +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.4 153/190] scsi: libsas: initialize sas_phy status according to response of DISCOVER Date: Wed, 11 Apr 2018 20:36:39 +0200 Message-Id: <20180411183601.553309708@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@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.4-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 @@ -282,6 +282,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)