Blob Blame History Raw
From c31dbe6c5c64ecdd28f7fb4d4d792ad07f981d1f Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 15 Sep 2020 13:12:50 +0200
Subject: [PATCH] nvme-multipath: retry commands for dying queues
Patch-mainline: Never, not applicable due to massive mainline refactoring
References: bsc#1171688

When we hit a non-ANA error and the queue is dying the error will
be returned to the caller, which is arguably wrong as we potentially
to have other paths to send the command over.
This introduces a different error handling, depending on whether the
queue was operational or not at the time the status got evaluated.
So requeue the command in these cases to avoid spurious errors during
failover.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/host/multipath.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -100,8 +100,12 @@ bool nvme_failover_req(struct request *r
 		nvme_mpath_clear_current_path(ns);
 		break;
 	default:
-		/* This was a non-ANA error so follow the normal error path. */
-		return false;
+		/*
+		 * This was a non-ANA error so follow the normal error path
+		 * if it's not a multipathed namespace.
+		 */
+		if (!ns->head->disk)
+			return false;
 	}
 
 	spin_lock_irqsave(&ns->head->requeue_lock, flags);