From: Jianchao Wang <jianchao.w.wang@oracle.com>
To: axboe@kernel.dk, hch@lst.de, martin.petersen@oracle.com,
keith.busch@intel.com, josef@toxicpanda.com,
ulf.hansson@linaro.org
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] nvme: use __blk_mq_complete_request in timeout path
Date: Wed, 20 Jun 2018 21:22:44 +0800 [thread overview]
Message-ID: <1529500964-28429-6-git-send-email-jianchao.w.wang@oracle.com> (raw)
In-Reply-To: <1529500964-28429-1-git-send-email-jianchao.w.wang@oracle.com>
To regain the capability to prevent normal completion path from
entering a timeout request, blk_mq_mark_rq_complete is introduced
in blk_mq_complete_request. Have to use __blk_mq_complete_request
in timeout path to complete a timeout request.
nvme_cancel_request uses blk_mq_complete_request, it won't do
anything on the timeout request, so add __blk_mq_complete_request
before return BLK_EH_DONE.
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
---
drivers/nvme/host/pci.c | 8 ++++++++
drivers/nvme/host/rdma.c | 1 +
drivers/nvme/target/loop.c | 1 +
3 files changed, 10 insertions(+)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 73a97fc..2a161f6 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1203,6 +1203,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
nvme_warn_reset(dev, csts);
nvme_dev_disable(dev, false);
nvme_reset_ctrl(&dev->ctrl);
+ __blk_mq_complete_request(req);
return BLK_EH_DONE;
}
@@ -1213,6 +1214,11 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
dev_warn(dev->ctrl.device,
"I/O %d QID %d timeout, completion polled\n",
req->tag, nvmeq->qid);
+ /*
+ * nvme_end_request will invoke blk_mq_complete_request,
+ * it will do nothing for this timed out request.
+ */
+ __blk_mq_complete_request(req);
return BLK_EH_DONE;
}
@@ -1230,6 +1236,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
req->tag, nvmeq->qid);
nvme_dev_disable(dev, false);
nvme_req(req)->flags |= NVME_REQ_CANCELLED;
+ __blk_mq_complete_request(req);
return BLK_EH_DONE;
default:
break;
@@ -1248,6 +1255,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
nvme_reset_ctrl(&dev->ctrl);
nvme_req(req)->flags |= NVME_REQ_CANCELLED;
+ __blk_mq_complete_request(req);
return BLK_EH_DONE;
}
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index c9424da..287eecd 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1617,6 +1617,7 @@ nvme_rdma_timeout(struct request *rq, bool reserved)
/* fail with DNR on cmd timeout */
nvme_req(rq)->status = NVME_SC_ABORT_REQ | NVME_SC_DNR;
+ __blk_mq_complete_request(rq);
return BLK_EH_DONE;
}
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index d8d91f0..627fbb0 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -148,6 +148,7 @@ nvme_loop_timeout(struct request *rq, bool reserved)
/* fail with DNR on admin cmd timeout */
nvme_req(rq)->status = NVME_SC_ABORT_REQ | NVME_SC_DNR;
+ __blk_mq_complete_request(rq);
return BLK_EH_DONE;
}
--
2.7.4
next prev parent reply other threads:[~2018-06-20 13:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 13:22 [PATCH 0/5]stop normal completion path entering a timeout req Jianchao Wang
2018-06-20 13:22 ` [PATCH 1/5] blk-mq: prevent normal completion from entering a timeout request Jianchao Wang
2018-06-20 13:22 ` [PATCH 2/5] nbd: use __blk_mq_complete_request in timeout path Jianchao Wang
2018-06-20 14:13 ` Josef Bacik
2018-06-20 13:22 ` [PATCH 3/5] null_blk: " Jianchao Wang
2018-06-20 13:22 ` [PATCH 4/5] mmc: " Jianchao Wang
2018-06-20 13:22 ` Jianchao Wang [this message]
2018-06-20 14:39 ` [PATCH 5/5] nvme: " Christoph Hellwig
2018-06-21 2:09 ` jianchao.wang
2018-06-24 18:07 ` Sagi Grimberg
2018-06-25 1:40 ` jianchao.wang
2018-06-25 18:51 ` Sagi Grimberg
2018-06-20 18:16 ` [PATCH 0/5]stop normal completion path entering a timeout req Keith Busch
2018-06-21 1:43 ` jianchao.wang
2018-06-21 8:19 ` Christoph Hellwig
2018-06-21 8:22 ` jianchao.wang
2018-06-22 15:10 ` Christoph Hellwig
2018-06-25 1:29 ` jianchao.wang
2018-06-21 13:13 ` jianchao.wang
2018-06-21 15:01 ` Keith Busch
2018-06-21 18:21 ` Bart Van Assche
2018-06-21 21:15 ` Keith Busch
2018-06-21 21:30 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1529500964-28429-6-git-send-email-jianchao.w.wang@oracle.com \
--to=jianchao.w.wang@oracle.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=keith.busch@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).