Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 604e8c8d authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe
Browse files

NVMe: reap completion entries when deleting queue



Make sure that there are no unprocesssed entries on a completion
queue before deleting it, and check for validity of the CQ
door bell before writing completions to it.

This fixes problems with doing a sysfs reset of the device while
it's handling IO.

Tested-by: default avatarJon Derrick <jonathan.derrick@intel.com>

Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 2fde0e48
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -968,6 +968,7 @@ static void __nvme_process_cq(struct nvme_queue *nvmeq, unsigned int *tag)
	if (head == nvmeq->cq_head && phase == nvmeq->cq_phase)
		return;

	if (likely(nvmeq->cq_vector >= 0))
		writel(head, nvmeq->q_db + nvmeq->dev->db_stride);
	nvmeq->cq_head = head;
	nvmeq->cq_phase = phase;
@@ -2787,6 +2788,10 @@ static void nvme_del_queue_end(struct nvme_queue *nvmeq)
{
	struct nvme_delq_ctx *dq = nvmeq->cmdinfo.ctx;
	nvme_put_dq(dq);

	spin_lock_irq(&nvmeq->q_lock);
	nvme_process_cq(nvmeq);
	spin_unlock_irq(&nvmeq->q_lock);
}

static int adapter_async_del_queue(struct nvme_queue *nvmeq, u8 opcode,