]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
nvme-rdma: avoid repeated request completion
authorSagi Grimberg <sagi@grimberg.me>
Thu, 22 Oct 2020 02:15:23 +0000 (10:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:20:24 +0000 (19:20 +0100)
[ Upstream commit fdf58e02adecbef4c7cbb2073d8ea225e6fd5f26 ]

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_rdma_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>
drivers/nvme/host/rdma.c

index cfd437f7750e110a8c0de455da07a01cab82b511..8a62c2fe5a5ec49978c7e68687fadd219a790e4a 100644 (file)
@@ -1727,7 +1727,7 @@ static void nvme_rdma_complete_timed_out(struct request *rq)
        struct nvme_rdma_queue *queue = req->queue;
 
        nvme_rdma_stop_queue(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);
        }