]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
nvme-multipath: fix logic for non-optimized paths
authorMartin Wilck <mwilck@suse.com>
Mon, 27 Jul 2020 16:08:02 +0000 (18:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:15:59 +0000 (08:15 +0200)
[ 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 <mwilck@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/multipath.c

index 5433aa2f76017e4aad0ffba98a26ea157160ac40..38d25d7c6bca30d08b1495cdd4d88c98a3a3bd0f 100644 (file)
@@ -249,6 +249,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;