]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
nvme-tcp: avoid repeated request completion
authorSagi Grimberg <sagi@grimberg.me>
Thu, 22 Oct 2020 02:15:31 +0000 (10:15 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 10 Dec 2020 11:06:23 +0000 (12:06 +0100)
BugLink: https://bugs.launchpad.net/bugs/1905618
[ Upstream commit 0a8a2c85b83589a5c10bc5564b796836bf4b4984 ]

The request may be executed asynchronously, and rq->state may be
changed to IDLE. To avoid repeated request completion, only
MQ_RQ_COMPLETE of rq->state is checked in nvme_tcp_complete_timed_out.
It is not safe, so need adding check IDLE for rq->state.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Chao Leng <lengchao@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/nvme/host/tcp.c

index 76440f26c1453962bd8cadf3a871e7f4e01d28b7..a31c6e1f6063a082a6a329f583b512b164be2cbd 100644 (file)
@@ -2071,7 +2071,7 @@ static void nvme_tcp_complete_timed_out(struct request *rq)
        struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
 
        nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue));
-       if (!blk_mq_request_completed(rq)) {
+       if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) {
                nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
                blk_mq_complete_request(rq);
        }