Blob Blame History Raw
From 1c0af4aff607da1b4d739f01b426c8163c7b0eb7 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 4 Jun 2020 13:56:01 +0200
Subject: nvme: check for NVME_CTRL_LIVE in nvme_report_ns_ids()
References: bcs#1171558 bsc#1159058
Patch-Mainline: No, handled differently upstream

When a controller reset happens during scanning nvme_identify_ns()
will be aborted, but the subsequent call to nvme_identify_ns_descs()
will stall as it will only be completed once the controller reconnect
is finished.
But as the reconnect waits for scanning to complete the particular
namespace will deadlock and never reconnected again.

Reported-by: Martin George <martin.george@netapp.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Acked-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 555bbe09795f..d7e08442cd22 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1451,7 +1451,7 @@ static void nvme_report_ns_ids(struct nvme_ctrl *ctrl, unsigned int nsid,
 		memcpy(ids->eui64, id->eui64, sizeof(id->eui64));
 	if (ctrl->vs >= NVME_VS(1, 2, 0))
 		memcpy(ids->nguid, id->nguid, sizeof(id->nguid));
-	if (ctrl->vs >= NVME_VS(1, 3, 0)) {
+	if (ctrl->vs >= NVME_VS(1, 3, 0) && ctrl->state == NVME_CTRL_LIVE) {
 		 /* Don't treat error as fatal we potentially
 		  * already have a NGUID or EUI-64
 		  */
-- 
2.16.4