nvme-pci: Fix timeouts in connecting state

"Linux Kernel Mailing List" <[email protected]> Sat, 17 Feb 2018 19:17:15 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/4244140d7b8f406b7edfd01c050dea783aa1efc5
Commit:     4244140d7b8f406b7edfd01c050dea783aa1efc5
Parent:     815c6704bf9f1c59f3a6be380a4032b9c57b12f1
Refname:    refs/heads/master
Author:     Keith Busch <[email protected]>
AuthorDate: Thu Feb 8 08:55:34 2018 -0700
Committer:  Keith Busch <[email protected]>
CommitDate: Tue Feb 13 17:09:50 2018 -0700

    nvme-pci: Fix timeouts in connecting state
    
    We need to halt the controller immediately if we haven't completed
    initialization as indicated by the new "connecting" state.
    
    Fixes: ad70062cdb ("nvme-pci: introduce RECONNECTING state to mark initializing procedure")
    Signed-off-by: Keith Busch <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
---
 drivers/nvme/host/pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index b427157af74e..73036d2fbbd5 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1215,13 +1215,17 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	 * cancellation error. All outstanding requests are completed on
 	 * shutdown, so we return BLK_EH_HANDLED.
 	 */
-	if (dev->ctrl.state == NVME_CTRL_RESETTING) {
+	switch (dev->ctrl.state) {
+	case NVME_CTRL_CONNECTING:
+	case NVME_CTRL_RESETTING:
 		dev_warn(dev->ctrl.device,
 			 "I/O %d QID %d timeout, disable controller\n",
 			 req->tag, nvmeq->qid);
 		nvme_dev_disable(dev, false);
 		nvme_req(req)->flags |= NVME_REQ_CANCELLED;
 		return BLK_EH_HANDLED;
+	default:
+		break;
 	}
 
 	/*
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html