Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp807586pxb; Thu, 28 Jan 2021 00:04:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvZEe9Vio3MZpYjDqrfvbX+aBLhA/spFFsZWU98kooPpEYIQ5qMxqJBSofrHzCwspo0uFm X-Received: by 2002:a17:906:d98:: with SMTP id m24mr9654737eji.428.1611821090583; Thu, 28 Jan 2021 00:04:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611821090; cv=none; d=google.com; s=arc-20160816; b=YNMIBDew+XCMPR8aTrMGrfbqMlP4dddVCysF+4UsSJyMFW5fAZVSaCKI8Rdg6LIte/ eOEPA31hsLDJcUlnP3mzp3T5gWKRo0eIy4W//yyIktMF0LZilqWkL9lyKdto4OhexV3d F/MDIIPoC3Kd6C8F5KWojK06JfWBaN1DVV2yEWPAtI6zok3KHkcfNjD/3LZcvLKqiAmk YLGCKDuSAsPFZqqgl/dJQi3CjhrGVimsuGwEpUENTSWcPg1e78Zn9t6Qgc184c43ObTI XTfc7FnZaZzOKcgYyQ3F7FqKQWe0CxwpLA48BdVofi421k2UcWMldcbPCUxol8gXlVPg 7hGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Hop89WPmVBHfYpFdRJyRUjqalr1cS9saJCd4CSSEFiY=; b=x4OAXw6IGd0jJsUalB7zgxT04KxHOL8RZnAiSakIAhVsPCPxZSAzKfFRWp9zmcgS3d ip11zlh/JiXLmxzJpCMksr0fkVBDcxjzAb40zzIIJ1JVJch4Tk1Rx/7t0nlVHJm+rdc8 UgFwhX09M1eUj5JSdL8K2E8eiYORu/Yh/MiylVyJAExhMjpmXWoyozaxxhM88sEGa9An ZvXzD/AiU2fZdcGJNNmDEAWQMQnIcOrCicDWPgIM6gvo/+pcITe6SmUwWW7oBWYgvTkB 5Tlr4ZDGJW9BphN39ZmtWHdu1O0XlD4tbCMVBJtmyDzjWZutP1vnNEy4ni3ASeN1F082 /rwA== 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 m25si2364806edr.186.2021.01.28.00.04.26; Thu, 28 Jan 2021 00:04:50 -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 S232178AbhA1IBW (ORCPT + 99 others); Thu, 28 Jan 2021 03:01:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:53004 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232201AbhA1H7y (ORCPT ); Thu, 28 Jan 2021 02:59:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id ED9D5AC45; Thu, 28 Jan 2021 07:58:37 +0000 (UTC) Date: Thu, 28 Jan 2021 08:58:37 +0100 From: Daniel Wagner To: Chao Leng Cc: linux-nvme@lists.infradead.org, Sagi Grimberg , linux-kernel@vger.kernel.org, Jens Axboe , Hannes Reinecke , Keith Busch , Christoph Hellwig Subject: Re: [PATCH v2] nvme-multipath: Early exit if no path is available Message-ID: <20210128075837.u5u56t23fq5gu6ou@beryllium.lan> References: <20210127103033.15318-1-dwagner@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.