Patch "nvme-loop: check if queue is ready in queue_rq" has been added to the 4.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
nvme-loop: check if queue is ready in queue_rq
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
nvme-loop-check-if-queue-is-ready-in-queue_rq.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Thu Feb 1 13:45:42 CET 2018
From: Sagi Grimberg <[email protected]>
Date: Tue, 24 Oct 2017 15:25:22 +0300
Subject: nvme-loop: check if queue is ready in queue_rq
From: Sagi Grimberg <[email protected]>
[ Upstream commit 9d7fab04b95e8c26014a9bfc1c943b8360b44c17 ]
In case the queue is not LIVE (fully functional and connected at the nvmf level), we cannot allow any commands other than connect to pass through.
Add a new queue state flag NVME_LOOP_Q_LIVE which is set after nvmf connect and cleared in queue teardown.
--- drivers/nvme/target/loop.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/nvme/target/loop.c +24 -1
@@ -61,10 +61,15 @@ static inline struct nvme_loop_ctrl *to_ return container_of(ctrl, struct nvme_loop_ctrl, ctrl); } +enum nvme_loop_queue_flags { +NVME_LOOP_Q_LIVE =0 , +}; +struct nvme_loop_queue {struct nvmet_cq nvme_cq;struct nvmet_sq nvme_sq;struct nvme_loop_ctrl *ctrl; +unsigned long flags; };static struct nvmet_port *nvmet_loop_port;
@@ -153,6 +158,14 @@ nvme_loop_timeout(struct request *rq, boreturn BLK_EH_HANDLED ; } +static inline blk_status_t nvme_loop_is_ready (struct nvme_loop_queue *queue, +struct request *rq) +{ +if (unlikely (!test_bit (NVME_LOOP_Q_LIVE , &queue->flags))) +return nvmf_check_init_req (&queue->ctrl->ctrl, rq); +return BLK_STS_OK ; +} +static blk_status_t nvme_loop_queue_rq (struct blk_mq_hw_ctx *hctx,const struct blk_mq_queue_data *bd) {
@@ -162,6 +175,10 @@ static blk_status_t nvme_loop_queue_rq(sstruct nvme_loop_iod *iod =blk_mq_rq_to_pdu (req);blk_status_t ret; + ret =nvme_loop_is_ready (queue, req); +if (unlikely (ret)) +return ret; + ret =nvme_setup_cmd (ns, req, &iod->cmd);if (ret)return ret;
@@ -275,6 +292,7 @@ static const struct blk_mq_ops nvme_loopstatic void nvme_loop_destroy_admin_queue (struct nvme_loop_ctrl *ctrl) { +clear_bit (NVME_LOOP_Q_LIVE , &ctrl->queues[0 ].flags);nvmet_sq_destroy (&ctrl->queues[0 ].nvme_sq);blk_cleanup_queue (ctrl->ctrl.admin_q);blk_mq_free_tag_set (&ctrl->admin_tag_set);
@@ -305,8 +323,10 @@ static void nvme_loop_destroy_io_queues( {int i; -for (i =1 ; i < ctrl->ctrl.queue_count; i++) +for (i =1 ; i < ctrl->ctrl.queue_count; i++) { +clear_bit (NVME_LOOP_Q_LIVE , &ctrl->queues[i].flags);nvmet_sq_destroy (&ctrl->queues[i].nvme_sq); + } }static int nvme_loop_init_io_queues (struct nvme_loop_ctrl *ctrl)
@@ -346,6 +366,7 @@ static int nvme_loop_connect_io_queues(s ret =nvmf_connect_io_queue (&ctrl->ctrl, i);if (ret)return ret; +set_bit (NVME_LOOP_Q_LIVE , &ctrl->queues[i].flags); }return 0 ;
@@ -387,6 +408,8 @@ static int nvme_loop_configure_admin_queif (error) goto out_cleanup_queue; +set_bit (NVME_LOOP_Q_LIVE , &ctrl->queues[0 ].flags); + error =nvmf_reg_read64 (&ctrl->ctrl,NVME_REG_CAP , &ctrl->ctrl.cap);if (error) { dev_err(ctrl->ctrl.device,
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/nvmet-fc-correct-ref-counting-error-when-deferred-rcv-used.patch queue-4.14/nvme-fabrics-introduce-init-command-check-for-a-queue-that-is-not-alive.patch queue-4.14/nvme-fc-check-if-queue-is-ready-in-queue_rq.patch queue-4.14/nvme-loop-check-if-queue-is-ready-in-queue_rq.patch queue-4.14/nvme-rdma-don-t-complete-requests-before-a-send-work-request-has-completed.patch