Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp640506pxb; Wed, 27 Jan 2021 17:43:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/k0QIFgzKiZh7oO+kRo2sR0HAF0RnwPVXNjNjpSDF2+1wkv8Jt8ik2nO+zGgnGOGXlIKy X-Received: by 2002:a05:6402:b68:: with SMTP id cb8mr11428037edb.346.1611798187217; Wed, 27 Jan 2021 17:43:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611798187; cv=none; d=google.com; s=arc-20160816; b=X0+PJemLKDRxh0VIiFEaM493CthahHnsJXRxTWWaq48LB+lauV8JsMrNArcKJJuV8E +dqNy3O6NKsgNIuLKxgmXKTMo1wL9kg2QqNLxpwh9+y/G4L4tOym+iargzIhnNO0DQgY 8kqmrW872pOxx3byv5kNzWufBPQB5WTsdVRqiKMjkMII+7wtAfwK6CN4o+5w5Y91wv74 sV0S9KAMNCjws6TBSr8oxabWwiajjtMq5j6mGj085ewvggpbo/rfM5FSF6nP4TMYLvUT NniLTCNoC0EubgRrZe/JA44z6kWGhI/xGp3S8wTCGyVstoD68BycQ4KlCpOC28yaAb2d /pqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=ZBSMN9b+W1CIsVx4mkCqB3srXuMHZtQ3QpQt2AlgBVA=; b=ike/TGNSGwN0Qmdz1PZdgyaTLzGGwWQ2ZGT/EbEcHPdreqk85rUw7K7iZieWVRG7oP mz8/48X6S0d0hbQq1Y7m1xn3/WOgxDjBqWvnbCHSlsfjvu8L+WxDva1CdnJdyv1MfFmk KIR7hGhZrdNmpAFsIfGq5xqJG2StOZMJQ0m+Trh3eJa0zRnyZpmQx5YWCjOidOifaN7F eIV/JXgNkekblnlzrVKH7WOCxFIxBd6IRW3vmWC9Gu6/d+2r5wZdk1TAFQboEJskxolW UrUl6CYINI5Au7ykdJHkkj0QlSHH7GcFRqM9TjKg2b9eJCS9AOncTRuly+5JlLoS/rJ+ c91g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm10si1712678ejc.64.2021.01.27.17.42.42; Wed, 27 Jan 2021 17:43:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbhA1Bh1 (ORCPT + 99 others); Wed, 27 Jan 2021 20:37:27 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:4591 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231431AbhA1Bg6 (ORCPT ); Wed, 27 Jan 2021 20:36:58 -0500 Received: from DGGEMM406-HUB.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4DR31n2S46zY3jw; Thu, 28 Jan 2021 09:35:09 +0800 (CST) Received: from dggema772-chm.china.huawei.com (10.1.198.214) by DGGEMM406-HUB.china.huawei.com (10.3.20.214) with Microsoft SMTP Server (TLS) id 14.3.498.0; Thu, 28 Jan 2021 09:36:14 +0800 Received: from [10.169.42.93] (10.169.42.93) by dggema772-chm.china.huawei.com (10.1.198.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Thu, 28 Jan 2021 09:36:14 +0800 Subject: Re: [PATCH v2] nvme-multipath: Early exit if no path is available To: Daniel Wagner , CC: Sagi Grimberg , , "Jens Axboe" , Hannes Reinecke , Keith Busch , Christoph Hellwig References: <20210127103033.15318-1-dwagner@suse.de> From: Chao Leng Message-ID: Date: Thu, 28 Jan 2021 09:36:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20210127103033.15318-1-dwagner@suse.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.169.42.93] X-ClientProxiedBy: dggeme704-chm.china.huawei.com (10.1.199.100) To dggema772-chm.china.huawei.com (10.1.198.214) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/1/27 18:30, Daniel Wagner wrote: > nvme_round_robin_path() should test if the return ns pointer is > valid. nvme_next_ns() will return a NULL pointer if there is no path > left. > > Fixes: 75c10e732724 ("nvme-multipath: round-robin I/O policy") > Cc: Hannes Reinecke > Signed-off-by: Daniel Wagner > --- > v2: > - moved NULL test into the if conditional statement > - added Fixes tag > > drivers/nvme/host/multipath.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c > index 9ac762b28811..282b7a4ea9a9 100644 > --- a/drivers/nvme/host/multipath.c > +++ b/drivers/nvme/host/multipath.c > @@ -221,7 +221,7 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head, > } > > for (ns = nvme_next_ns(head, old); > - ns != old; > + ns && ns != old; nvme_round_robin_path just be called when !"old". nvme_next_ns should not return NULL when !"old". It seems unnecessary to add checking "ns". Is there a bug that "old" is not in "head" list? If yes, we should fix it. > ns = nvme_next_ns(head, ns)) { > if (nvme_path_is_disabled(ns)) > continue; >