Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp845092pxb; Thu, 28 Jan 2021 01:24:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyouWbgG9FN6zs/B9VFcLG8cNWYbyWlk2Eblwq4QQUFGS08RLgXjxxoBvJ00TkhccafiF3C X-Received: by 2002:aa7:d148:: with SMTP id r8mr13040423edo.127.1611825858126; Thu, 28 Jan 2021 01:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611825858; cv=none; d=google.com; s=arc-20160816; b=1KA6h0rmpF6S/vJZwywKpcSh8VFeHdFqrRZ+vnENk66PhA6tKqoY0ZGoPmHSqKjY86 TP19TWi3mLy4/aGdul5T24mdR7hTUBuJX397vVrHJxTLWnqojPOJ/FX9OCvpDh/kmt6Z MERy1EzCyV353M2vzFhSkUineNykgmx/Xhb5SIwaNWemqENgV3w2h2d2VOd0TZMiLKcE 9SNzozRL+CUx0gYs3deke6QjzjYOTgWn0R/eC3TpsYc5LGaODWQa9G2p5mPtPstnCYhM 8Hqde4tQW0YMa04wXNjz8hN5T6ZgiFDf17abQTJUXAR9KZwuGm1+SbZX/uudWAK6AAl1 Vyhw== 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=/iz73r53RF6YWZPb1bNZDBye0pr7lES/kTAoPTLgWsc=; b=kxIUW+O7eEEYOIKUKDksYUpY50wtrljq0oKV946Xmbk7HrS3TyX+wnUHyCw/lsELWU LF0g/7X3QYlcV3g78VYXSq1mx5hEQPCF8YOChmSRgOPm/T3BYUYnXN0XXgz01G9sqf55 f/YpYYEjFi58LA41WRz/P3fkeC0PxnttA4/RIlsVdTCQFDfgrXufKqNDaDw+xHe8fnOF uH1BdPC4jjO1Cnn29YuRJfYSfh+sb2MyTxD/3Mot/+O/d7fykhhhKr5j0Gs3KOICktgX NKI04jBzzDtGs48TFM0/uWlctLL0pTapmjPsEIqfaQyHOpGkJByFoJ8jVsy0Ng/tuelN yG5Q== 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 ds7si2606212ejc.212.2021.01.28.01.23.54; Thu, 28 Jan 2021 01:24:18 -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 S232524AbhA1JWg (ORCPT + 99 others); Thu, 28 Jan 2021 04:22:36 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:2567 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232532AbhA1JTr (ORCPT ); Thu, 28 Jan 2021 04:19:47 -0500 Received: from DGGEMM405-HUB.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4DRFGf5zyKzW2PM; Thu, 28 Jan 2021 17:16:58 +0800 (CST) Received: from dggema772-chm.china.huawei.com (10.1.198.214) by DGGEMM405-HUB.china.huawei.com (10.3.20.213) with Microsoft SMTP Server (TLS) id 14.3.498.0; Thu, 28 Jan 2021 17:18:58 +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 17:18:57 +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> <20210128075837.u5u56t23fq5gu6ou@beryllium.lan> From: Chao Leng Message-ID: <69575290-200e-b4a1-4269-c71e4c2cc37b@huawei.com> Date: Thu, 28 Jan 2021 17:18:56 +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: <20210128075837.u5u56t23fq5gu6ou@beryllium.lan> 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: dggeme708-chm.china.huawei.com (10.1.199.104) 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/28 15:58, Daniel Wagner wrote: > On Thu, Jan 28, 2021 at 09:31:30AM +0800, Chao Leng wrote: >>> --- 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". > > The problem is when we enter nvme_round_robin_path() and there is no > path available. In this case the initialization ns = nvme_next_ns(head, > old) could return a NULL pointer."old" should not be NULL, so there is at least one path that is "old". It is impossible to return NULL for nvme_next_ns(head, old). > . >