Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3288753pxa; Sat, 8 Aug 2020 16:51:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzny09zYI+Urv/rApkDI9ajDfybPkXw6jnTTLavYffD5Xgk3cYsw6FULr/QMVJ2l+Kd/7WV X-Received: by 2002:a17:906:bb0e:: with SMTP id jz14mr9248219ejb.525.1596930670545; Sat, 08 Aug 2020 16:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596930670; cv=none; d=google.com; s=arc-20160816; b=Cce7I+hQ2JYt0cCuRMFA6qtCupK9LbsWnlFQDLkjj/6gNImeyKtppJ9IUzm/wjDTlO UW1uPBtV06nSLItK45o12MRdpQaOCPVY8pNFw+Y5C8VN0h0zzLn4FBMrVSihKUBi6KaO ebAjk83Xb50/7UDTiiU6zj7xIlNM9wzhbVHgHk/uT9+pu758siZ0u3LqOdE0Q7apqmZz tIHdD9LbXXMKQmh3R9X9cdtX1y8FAPGhSYHATRLz59lo8sf0Ufq+RYYIbdLPbKGlgSDt T/rIQ6D0zvsnapoTgLZuCbigWMrpxw1hEKPWxJnPRkQNKuWAwodE/dtFITpv02n7Kt9T yG2A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q8aQ+762ay34YwTCyHH49p4yZyh4lvYHvYbVNh40DQU=; b=SbVFkeGinX+fvTJCQqk+WoZl6OXJIGxLjV3ZDy3P7rvtvIIOQ4W9BQQLmS/h73dlpg TCeHfZVKFz9R9WD//IWvNHd0VGivqbL7dnPI1H9BY3HhcboxvObiPw8NW03UBYQXJfFu Meg8urTB466yMkXcUMdgwXxi7bfFSRqFYvu2uc1qd/EnfCs1EKB4KtIZ6MuLWUVtEe/1 ZxqEg6xbqKxt+GF/7q0XSXJJ5g9DPwtBEg25ZhxvJZWpBQnfaKUEwkL5oZ54ilZ9uX0t 1cKqiter9Zo4QdEdTN8uL9EOIzyab2vrg+RylBNsabn8SgGJZGwjkwrqQknIyt8WfiIV +FbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AcwZA6Y+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yl26si9412848ejb.625.2020.08.08.16.50.47; Sat, 08 Aug 2020 16:51:10 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=AcwZA6Y+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728103AbgHHXsl (ORCPT + 99 others); Sat, 8 Aug 2020 19:48:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:50250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbgHHXhV (ORCPT ); Sat, 8 Aug 2020 19:37:21 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9CB0F206E9; Sat, 8 Aug 2020 23:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596929840; bh=QDAW9zoveqrWFCuC7xBLGn80jtKBU8onUkR3R7/heiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AcwZA6Y+ypqr2wkInlkOpVtuLEsfUZeJoy/SZdl3IkdRwjGE7xBfVZjuzh2AkeJkz +TC3EYFLvI7t0mMfKzi5BxM77X2sXquLXVQUVMA282C+eN7J/7xXwH2LCrhVW7njQ1 fY3q3y9xxeQ0u0Z/ZsdJFi7+uargv+Ujvok4oKqY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hannes Reinecke , Martin Wilck , Sagi Grimberg , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.8 70/72] nvme-multipath: do not fall back to __nvme_find_path() for non-optimized paths Date: Sat, 8 Aug 2020 19:35:39 -0400 Message-Id: <20200808233542.3617339-70-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200808233542.3617339-1-sashal@kernel.org> References: <20200808233542.3617339-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hannes Reinecke [ Upstream commit fbd6a42d8932e172921c7de10468a2e12c34846b ] When nvme_round_robin_path() finds a valid namespace we should be using it; falling back to __nvme_find_path() for non-optimized paths will cause the result from nvme_round_robin_path() to be ignored for non-optimized paths. Fixes: 75c10e732724 ("nvme-multipath: round-robin I/O policy") Signed-off-by: Martin Wilck Signed-off-by: Hannes Reinecke Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/multipath.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index fe8f7f123fac7..57d51148e71b6 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -272,10 +272,13 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head) struct nvme_ns *ns; ns = srcu_dereference(head->current_path[node], &head->srcu); - if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR && ns) - ns = nvme_round_robin_path(head, node, ns); - if (unlikely(!ns || !nvme_path_is_optimized(ns))) - ns = __nvme_find_path(head, node); + if (unlikely(!ns)) + return __nvme_find_path(head, node); + + if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_RR) + return nvme_round_robin_path(head, node, ns); + if (unlikely(!nvme_path_is_optimized(ns))) + return __nvme_find_path(head, node); return ns; } -- 2.25.1