]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.51/nvme-pci-shutdown-on-timeout-during-deletion.patch
Linux 4.19.51
[thirdparty/kernel/stable-queue.git] / releases / 4.19.51 / nvme-pci-shutdown-on-timeout-during-deletion.patch
1 From 2de4c8bd09143c867e65bf594215719d30d2b02c Mon Sep 17 00:00:00 2001
2 From: Keith Busch <keith.busch@intel.com>
3 Date: Tue, 30 Apr 2019 09:33:40 -0600
4 Subject: nvme-pci: shutdown on timeout during deletion
5
6 [ Upstream commit 9dc1a38ef1925d23c2933c5867df816386d92ff8 ]
7
8 We do not restart a controller in a deleting state for timeout errors.
9 When in this state, unblock potential request dispatchers with failed
10 completions by shutting down the controller on timeout detection.
11
12 Reported-by: Yufen Yu <yuyufen@huawei.com>
13 Signed-off-by: Keith Busch <keith.busch@intel.com>
14 Signed-off-by: Christoph Hellwig <hch@lst.de>
15 Signed-off-by: Sasha Levin <sashal@kernel.org>
16 ---
17 drivers/nvme/host/pci.c | 5 ++++-
18 1 file changed, 4 insertions(+), 1 deletion(-)
19
20 diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
21 index 377f6fff420d..c8eeecc58115 100644
22 --- a/drivers/nvme/host/pci.c
23 +++ b/drivers/nvme/host/pci.c
24 @@ -1132,6 +1132,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
25 struct nvme_dev *dev = nvmeq->dev;
26 struct request *abort_req;
27 struct nvme_command cmd;
28 + bool shutdown = false;
29 u32 csts = readl(dev->bar + NVME_REG_CSTS);
30
31 /* If PCI error recovery process is happening, we cannot reset or
32 @@ -1168,12 +1169,14 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
33 * shutdown, so we return BLK_EH_DONE.
34 */
35 switch (dev->ctrl.state) {
36 + case NVME_CTRL_DELETING:
37 + shutdown = true;
38 case NVME_CTRL_CONNECTING:
39 case NVME_CTRL_RESETTING:
40 dev_warn_ratelimited(dev->ctrl.device,
41 "I/O %d QID %d timeout, disable controller\n",
42 req->tag, nvmeq->qid);
43 - nvme_dev_disable(dev, false);
44 + nvme_dev_disable(dev, shutdown);
45 nvme_req(req)->flags |= NVME_REQ_CANCELLED;
46 return BLK_EH_DONE;
47 default:
48 --
49 2.20.1
50