Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2538925rbb; Wed, 28 Feb 2024 05:14:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXdYDyQQea3pPx67hNmBzUQUM5MnG4QtljnxkD+s6HvTG4gkN4Bck01o+yym3lAquI18N3pfCk+gxbefp+3M0vPU6gRQM1kGBkOKhB9KQ== X-Google-Smtp-Source: AGHT+IE41vWg1QN2jHnbWKDqUqv908/yExXOFnLdEda3fLZsWG7iXodi61lWTN2mFwgh/g6j+xP1 X-Received: by 2002:a0c:f30b:0:b0:68f:ef85:47a4 with SMTP id j11-20020a0cf30b000000b0068fef8547a4mr4599812qvl.30.1709126052288; Wed, 28 Feb 2024 05:14:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709126052; cv=pass; d=google.com; s=arc-20160816; b=xxVoRhhqf2RSezRaObcOCoDx8BAOM9Z+gUdg672CY8XU3fh2pqXstichKt3Y3vGhvw ECMUJ2C3pLpyZm4QfUfVxKgUlaRSNLeuAIYbpy0GvdlZdusi2bnZLLTE8c+fDZ7GHvBp HL4nPJVOnNI0gqG1etUCgKEP87sdKyYHdw3ucqG7OuYBTpcKWCqTCLK9w6cIDoZ5bfDB mtL04v37ldN3suuUyvxgNM7K5r7eaZxrXziJrco5nGjV/76rV7onY461AFhm2HpBDCBs J5YBnShsgriqRSfFi5Pu+EZJAmZC+ONM/xqbR+9x+eXpFRPMAwlQXZD2rDqu3EiumlAL N2YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=7pr44DPvi65gqGrWv0RQys6cVrdsZantuf2HrVgfv/w=; fh=bL8G/t/fAy0O+IRRnRyEuNf+4P0AsaEYRJUOguDAI5g=; b=lMKq+/qa5hpgA2YDYxaVhj8j6iXm40DYIGtyyYajDPO3DDls3V4kAOAQWspgjwttus L/FdSA96KXHPSFbHJz15oVLuMWoG82nrb8Fd1tw5Z9b1nMPZomWotzdsqo/xIpDEymJ3 5H+fqKt8ZRL8az+NSs6lPcGDp5JBPoWhsL0ou8Ut4B6VTo6PH+KpzLbneT0C77zdnT2I sLwDLqMz6RkKYeR4zvSLlCmL3FS98+ethwEMvWOwOKYg0WxmyU8wIg6UgwKpK+SLBfd0 hTdjRqyszB0VCRFTXDtdJV2QLtctxsXqg0ycnB1uKeHPakIwg/0HS5+c39WcEkOX54Jk zJhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-85078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85078-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kj16-20020a056214529000b0068cb0d39be6si9453742qvb.521.2024.02.28.05.14.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:14:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-85078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85078-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 10C201C25646 for ; Wed, 28 Feb 2024 13:14:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C24014C582; Wed, 28 Feb 2024 13:13:58 +0000 (UTC) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06AAE149E0B; Wed, 28 Feb 2024 13:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709126037; cv=none; b=ZdP5ak93nlT60V92o77ZoU8oIkDghEBijn7mqLlqkHn4gp2r7d1r5iiFVwll1XlxBX0Lgb0L1o24gWYacaGc6z6VAXdFFbZPrXiejqxb0VdeTPN/IMGtwcoplA6rZ/EEE+YN94AHge2QnpZzzUqXfYYS6CTOwd9KR7zZymM1LRE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709126037; c=relaxed/simple; bh=HgwVfW0K+Hhu2RJ2w8yehDlFn8KAHL04pm/mocETtp0=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=ScBJPmK63lQa0ygbcYtugbbP+p4ex4A5fps5HNG/WC1bzdj3Wv9WvEw4UHtU49+YA4dH38wtlf7cOU780oHn3dEZ2n2JzMeKTmQhESlhsITeiT79Z2qdXfxkhz4JGEONxOFX2CxMl6TLm6JTzkBClN84KDnxn4XGUGqGcM18Uwc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4TlFCZ73XBzqhs3; Wed, 28 Feb 2024 21:13:14 +0800 (CST) Received: from dggpemd100001.china.huawei.com (unknown [7.185.36.94]) by mail.maildlp.com (Postfix) with ESMTPS id 3CE591A016B; Wed, 28 Feb 2024 21:13:52 +0800 (CST) Received: from [10.67.120.108] (10.67.120.108) by dggpemd100001.china.huawei.com (7.185.36.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Wed, 28 Feb 2024 21:13:51 +0800 Message-ID: <693dec74-1750-191e-cbc3-37f993d165ac@huawei.com> Date: Wed, 28 Feb 2024 21:13:51 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 Subject: Re: [PATCH] scsi: libsas: Fix disk not being scanned in after being removed Content-Language: en-CA To: John Garry , , , , CC: , , , , , References: <20240221073159.29408-1-yangxingui@huawei.com> From: yangxingui In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggpemm100023.china.huawei.com (7.185.36.248) To dggpemd100001.china.huawei.com (7.185.36.94) Hi John, On 2024/2/22 20:41, John Garry wrote: > On 21/02/2024 07:31, Xingui Yang wrote: >> As of commit d8649fc1c5e4 ("scsi: libsas: Do discovery on empty PHY to >> update PHY info"), do discovery will send a new SMP_DISCOVER and update >> phy->phy_change_count. We found that if the disk is reconnected and phy >> change_count changes at this time, the disk scanning process will not be >> triggered. >> >> So update the PHY info with the last query results. >> >> Fixes: d8649fc1c5e4 ("scsi: libsas: Do discovery on empty PHY to >> update PHY info") >> Signed-off-by: Xingui Yang >> --- >>   drivers/scsi/libsas/sas_expander.c | 9 ++++----- >>   1 file changed, 4 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/scsi/libsas/sas_expander.c >> b/drivers/scsi/libsas/sas_expander.c >> index a2204674b680..9563f5589948 100644 >> --- a/drivers/scsi/libsas/sas_expander.c >> +++ b/drivers/scsi/libsas/sas_expander.c >> @@ -1681,6 +1681,10 @@ int sas_get_phy_attached_dev(struct >> domain_device *dev, int phy_id, >>           if (*type == 0) >>               memset(sas_addr, 0, SAS_ADDR_SIZE); >>       } >> + >> +    if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) >> +        sas_set_ex_phy(dev, phy_id, disc_resp); >> + >>       kfree(disc_resp); >>       return res; >>   } >> @@ -1972,11 +1976,6 @@ static int sas_rediscover_dev(struct >> domain_device *dev, int phy_id, >>       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); > > It would be nice to be able to call sas_set_ex_phy() here (instead of > sas_get_phy_attached_dev()), but I assume that you can't do that as the > disc_resp memory is not available. > By the way, I have updated a version and call sas_set_ex_phy() here, please check it again. Thanks, Xingui