Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp240479ybi; Wed, 29 May 2019 20:26:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwqV21zBV7LsGdYmrW188+HPZ27iI14zc0+9sgeZdSpv5ShZdDXnu+fYVAp30hJjvGWVM0 X-Received: by 2002:a63:e645:: with SMTP id p5mr1699475pgj.4.1559186816192; Wed, 29 May 2019 20:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559186816; cv=none; d=google.com; s=arc-20160816; b=UlfxaDp58jRUa8goI1xGz0zVY78RZRpwpzGT901cfHksO8d5/Gt3vYWF3xQb1skwYw vy2DhLiVsroVGLrkrQsHTLsLe4Y1jFVQOGCuaWB4XxPvhSuwT2tJr4c4RV0BEpjYkMna 5Ern5F3fzjdSDx7+LqZGno7wjKdErWgoe2HwGFChJIyqFZW2JNxPi4tXk9Asqri6L8da DDcCowcJmExHIWX62Nnihfd3ZQA2Ov1AqB+F+0nosps2kNb71YJEDNZKYOONcqcjZIpU OfbVtbWgMG1qUWwxZn+xkjF2N2G/ghtuRibAYfayOSAOgW/Lu0nt0ofp/NxCujkUrU+u xTCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6ngQ2BjtLMH77n+qi0S3REPYDCcCdVFDXzxgw1SQD6Q=; b=XRHcvh/p20HQOnl18R148yepdutoPzZ7RmQsSthCdHOanHWNdnZbhClcVfP9EMddUY mhfVRCASh7GDDUhanDBlX6ZLoHU97hrGji+qji2X/kP298uU44nD5pXjOmmsjj5in4/P doTvTxvmZLPNOyivMp16FJHuTnB1myhL2vl/Qe4WPaukvcZiRP8TxROFAKniUqtTvHYD Se+2O0YB8Y8UVi9ahuwqsJyHNdA0o+hZgvSA2UoEYfTorYnYm2GAdn2DGpZD25XOZKMX RbmLkOLAiw1JLPHnzM91TKGDYBqdEJTWxKJ/p5YF+h8740ApT45WiKkbTzAbdKZC8Jp4 c/qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nnVO4nrD; 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 v5si1896610pgs.285.2019.05.29.20.26.39; Wed, 29 May 2019 20:26: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; dkim=pass header.i=@kernel.org header.s=default header.b=nnVO4nrD; 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 S1732213AbfE3DXc (ORCPT + 99 others); Wed, 29 May 2019 23:23:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:47104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731109AbfE3DR0 (ORCPT ); Wed, 29 May 2019 23:17:26 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D7C824667; Thu, 30 May 2019 03:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186246; bh=cQdBM9Xz0Y7+kjgxoQTPLsP0hRNgeCXRLMGDgBIxynM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnVO4nrDf3IgXZVRkYy8GzL9ree0OyDuQtAe5fY4gYBjicAN/tHBevKz79m3Ywnys 0p9Pdzo8MBiKy5pcjGd+4sUytqBJ2hgVUAsBox81iVzbhI+h8yxPQz2Oog3RlJczrP cUxM/qISlgWc2vfUjL6arZ5M4A2tdIK1XzkFo+f8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 162/276] scsi: libsas: Do discovery on empty PHY to update PHY info Date: Wed, 29 May 2019 20:05:20 -0700 Message-Id: <20190530030535.599743068@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit d8649fc1c5e40e691d589ed825998c36a947491c ] When we discover the PHY is empty in sas_rediscover_dev(), the PHY information (like negotiated linkrate) is not updated. As such, for a user examining sysfs for that PHY, they would see incorrect values: root@(none)$ cd /sys/class/sas_phy/phy-0:0:20 root@(none)$ more negotiated_linkrate 3.0 Gbit root@(none)$ echo 0 > enable root@(none)$ more negotiated_linkrate 3.0 Gbit So fix this, simply discover the PHY again, even though we know it's empty; in the above example, this gives us: root@(none)$ more negotiated_linkrate Phy disabled We must do this after unregistering the device associated with the PHY (in sas_unregister_devs_sas_addr()). Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libsas/sas_expander.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index e9ecc667e3fb4..231eb79efa320 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -2040,6 +2040,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { phy->phy_state = PHY_EMPTY; sas_unregister_devs_sas_addr(dev, phy_id, last); + /* + * Even though the PHY is empty, for convenience we discover + * the PHY to update the PHY info, like negotiated linkrate. + */ + sas_ex_phy_discover(dev, phy_id); return res; } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && dev_type_flutter(type, phy->attached_dev_type)) { -- 2.20.1