Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp244126ybi; Wed, 29 May 2019 20:31:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNJjxgguHewA0CPyzaOgkkxAoVxUATJgo++6byx80fo3V0ktF4aokrVFhfWNdq+Vyewk2M X-Received: by 2002:aa7:93bb:: with SMTP id x27mr1530654pff.104.1559187089942; Wed, 29 May 2019 20:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187089; cv=none; d=google.com; s=arc-20160816; b=vQmxbSeasvknBjW8P6lzPgJXTL79qY7F2dJqZdIxHmyGNCfl0W8l8P3xaR7alCiBDM uhZWaLoYg/f/aGUE55W1EnxMpCIWjwvkZbsmy38qjrvICeu1mQHeEtaqZE4qXMQYg+L4 JXmd8hGqVOibOxGKJOkRhSb70FbMLAydsz5pDQjyVTi/hpEGAyksjedzEp8t3S7hHlET N6T3tK03lD5/bYr6HY2N+2B80Z0+8HjszgfPOIQn52/QdHH5NDRlex6a55lI5L8cHZbv r/L7cCuWf19Bdc3MDCtZL9cfF9MZM82ZH+0AvEz6NaylAK13BKFaMqTKDJYhtE8dVfge P/Qw== 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=+KHXdHuXuj8n2NVmQ4uDsn0KbWiR08neSEcMdll0Q1U=; b=kzxN7HJxIMjq8T7EEtMA+oURdeJVlidT0qU8xWGqqbvsnEmTLIuA3WvUn7Nz+p3H22 HMkmm981Ob4kQQxHMMh9dTeVH5556WvQ1E/fL/ZuDRtYLVdL/0G0CHqo3HSnrhtliP+C bKGwTIXA7otqov2JCFRl59UYYGtRDVY6wF0oB6u8ci8PSRnAKs3PUCaVddVJoAsGaHFU W7W6mUrAxF7C7G8tMhGSwUQ0B1qevQ2E1FrnegRXhEioTUy8QICXr4YpM5hyZNRALeuD 8ecmL55jHmBz6lQ6ID3lChQuEYrKa/IcQDx2SxThQoSppMtq/zJb5ww2X6GPrXoonPuS Oyig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b2Igrhy9; 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 k16si2174785pfk.68.2019.05.29.20.31.13; Wed, 29 May 2019 20:31:29 -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=b2Igrhy9; 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 S2388465AbfE3D35 (ORCPT + 99 others); Wed, 29 May 2019 23:29:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:60900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731180AbfE3DVB (ORCPT ); Wed, 29 May 2019 23:21:01 -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 90F56249A9; Thu, 30 May 2019 03:21:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186460; bh=cUOQWn5WeOO5C2d4/1sFxufHKsFKwSesPfLkcaF011Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2Igrhy95QYI6cu1hp6PRngaBboOQP193YiPhBSvO6GjQBTlV6y5MDQWg065sc2h5 shCcEVdmMmQKpJ3iA+C6gcZz9a+DAyEFec+pPvwk6vTZk2skNdiEQZg3oNSM+My2Tz Deo/YiK31UEpTDYm9+4JC5F7kleT0ssC1BAMLX9g= 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.9 077/128] scsi: libsas: Do discovery on empty PHY to update PHY info Date: Wed, 29 May 2019 20:06:49 -0700 Message-Id: <20190530030448.455271747@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030432.977908967@linuxfoundation.org> References: <20190530030432.977908967@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 1a6f65db615e8..ee1f9ee995e53 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -2027,6 +2027,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