From patchwork Mon Aug 17 15:11:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 266078 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22234C433E1 for ; Mon, 17 Aug 2020 19:06:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0434A20738 for ; Mon, 17 Aug 2020 19:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597691160; bh=dAoe88Mtbo9LtHCsMieDiuSyR9ZBSp9hgxYb9HLpeHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WMEOCNomnlHszmeB0HaXm2GMTnUhZCKHvHGD5yigrKZSKA/aNTTqTyr6MU6yiNkOr hSt8pqOGhw4KgSlnQxI1smOL8JcFSCZPLY7chbwb40ttmW5vniEQCGSCg05gearwIY XHKvuiG/3+TwgZRk8UieuGzmo5StGsHa67exdXuo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731828AbgHQTFz (ORCPT ); Mon, 17 Aug 2020 15:05:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:55638 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387701AbgHQPoo (ORCPT ); Mon, 17 Aug 2020 11:44:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 390DC22BF3; Mon, 17 Aug 2020 15:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679083; bh=dAoe88Mtbo9LtHCsMieDiuSyR9ZBSp9hgxYb9HLpeHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RExdoTNjmKAx4t09F5K1q9PcQ2JMaYYh1wXdyvZYXRK/0BwrD/cz6fWkeSrm7DUCA 6pTuqMWXgWnh1DvbWr+7erhGQTYQvl3VZsCZVOsZeE8wkRFk+/MO7liI6a/E/qtICi pQc+H6bclEhdqPkCbcebTUwlLFGslD/FnZmh6qJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hannes Reinecke , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.7 060/393] nvme-multipath: fix logic for non-optimized paths Date: Mon, 17 Aug 2020 17:11:50 +0200 Message-Id: <20200817143822.533323614@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Martin Wilck [ Upstream commit 3f6e3246db0e6f92e784965d9d0edb8abe6c6b74 ] Handle the special case where we have exactly one optimized path, which we should keep using in this case. 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 36db7d2e6a896..2c94e084a61b8 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -246,6 +246,12 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head, fallback = ns; } + /* No optimized path found, re-check the current path */ + if (!nvme_path_is_disabled(old) && + old->ana_state == NVME_ANA_OPTIMIZED) { + found = old; + goto out; + } if (!fallback) return NULL; found = fallback;