Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3862050pxb; Tue, 17 Nov 2020 05:38:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQ5s35/b7GNkacPEAe1yudPhNO+qNSz8B73yeFDga0hT1ELtePcME7ZtPg2TA+FHN+CUgV X-Received: by 2002:a17:906:1804:: with SMTP id v4mr19455698eje.201.1605620334225; Tue, 17 Nov 2020 05:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620334; cv=none; d=google.com; s=arc-20160816; b=SWMOOYHVDQea5p7LAdjpp9oLGryZ1Dea6JrgdSTSwL/aApzzRQ39ZtEJQDj+oKVodD PZIXAiCYBPD871Jrs+kZKEWqlYy0D1vbwgLzyxnuvG85HC5qC4s+W/1pc3q5hIhUx4oe +/3krcyyyLneFS/j5GtQPywPx7SSoYOexwk44jvaOUWln7P+cb56uOdz43J9gYSnSx0B yZ9riTwQegAiUaIpJofidQjyVxU1r6IIOff33UTQx17n2oBtvXHAL+YofjHkbfYoL2Zt l/14csjpkNhvvgp2rdjx4LRMxpD6BT8d7QUtfJyOeIBUrmdArBboUUTceOAhkDBI0sSe 5I0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vuLGT9sgL2aU9LHmh8k8g3FLwyetSsFMipAGgw2F8bw=; b=0QmF+7IINgXjjdmPTQBzKSNGEeR4ulQJqR68TK/qLou4YpeocjkRAe7HB6gak4Yh7U +G4l7qMkkH2rQmjvm+657xIbuPWWB7Vm7hALax21EYHeZNGZCKeon3q+pcnxL5VjZ2cg vg/wfLo9LvSi+T4nOJDljoeCuO3fz289d6dlEY0+6TK1K8uitlt3VGuReqpHfiAhsYgn ctyLI5Pb5eC2A72RizHGeVMs+J5HA+uyi9wECz76U8DBl22S1dedQvt8eILrIdaGKzk3 p0iYfOJc+F2xXbWmMvDwxHMOxDQua4OIsHsRmZLa+jyFIqBQumK1CROxIIY+R63h8OBR jtLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q6H+Xje7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz6si16211589edb.297.2020.11.17.05.38.31; Tue, 17 Nov 2020 05:38:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q6H+Xje7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732368AbgKQNfO (ORCPT + 99 others); Tue, 17 Nov 2020 08:35:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:45820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732433AbgKQNfK (ORCPT ); Tue, 17 Nov 2020 08:35:10 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D09002465E; Tue, 17 Nov 2020 13:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620110; bh=s8zYsADDEm3HMFvjpIL9cWv+bO0V/ydArzW6IdD9Q90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6H+Xje7IFxPtDVzTBkCGYB6IDuQ35wdtF7K+HEsW4mYHWXBc2zO8LblNUkFCFyJ4 RhAZRyTn0IreNroiE2ewavXa8+bOgGqrRVieOFd8lPm0WtCh6261FOpqMdVyIqiReb BhH1SJ7Md6P1dEyttyJgigvQO2ZvA7ab53+xhiQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sagi Grimberg , Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.9 110/255] nvme-rdma: avoid repeated request completion Date: Tue, 17 Nov 2020 14:04:10 +0100 Message-Id: <20201117122144.308871571@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sagi Grimberg [ 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 Signed-off-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 73961cc1e9799..f91c20e3daf7b 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1974,7 +1974,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); } -- 2.27.0