Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3861462pxb; Tue, 17 Nov 2020 05:38:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJNeE8vVYOB+M+XBOuYI0EDVS+v/Uja3V3ZOdYIVYQM7uC/mJCWjDDsmgU95cmUlfjkbl/ X-Received: by 2002:a17:907:6ef:: with SMTP id yh15mr18524207ejb.506.1605620289367; Tue, 17 Nov 2020 05:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620289; cv=none; d=google.com; s=arc-20160816; b=A7sp5UEj27q7Uf7t9RfPVqpw4gl3LnV1jKgBfdvcMW9Q0zyQ6MQZofdpRdbVt8D29f PkQsuzsWpyHQj0w13pOU9SLEw/nGCWGnrbDspGmjjcBqeTkFdBqA0vba8VgIRuKnyC+q NASm0oorVMQxeKmh8YpG4LSwjG7nIL/KSEkoPY7/2K8u6jaWa8JELJL+dX7B4JMit5Tk ylCvPUqfcftq2oRVbihkZA25eTZPXg9p5xNdMUVmANT4wPDlQFOAO5ddieG33YaWSu9K xKFVSXbr43a9c1L9qL9zBt7iunLsA0rt+OC8b9bM9id8bLAUw5bySdOS11XbigCLXiBm 9x1A== 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=ueimhLK02aQ08hckxg8iQoGDrbJWy6QJk/zuqRXxbXo=; b=smWckIGeQuzqlf4KpBv2W/V8SS65FXxAXzXEKRvOS/Fjsif+r3oiIeHWFcpY00F48d FnO/9Jcguq3qOOm1Sjwnl0t18aF47nJt748M2VH1Qsy7FtdqgB+AVPOjzZcBN2vmVuGl eofugJgymT5sntYxkWGAnp1LNAc6G50p7Di396UBLfzmBl2X/1aHShNUht38tMcwjKIj nt/vo6sSW8+PyeHke8BjC+K8seLpJzQB9t49cvpL/fh50dbFofVY4cwYt2IX3gXrLHMj 9dmLhANSZL/hlOqZWGMYU1KQX1XZYw+gmDuLGevmRSb+mqALxwqVwOtqxgxl4EuEKtA3 h/IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x6NYqaqW; 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 d4si13325948ejd.492.2020.11.17.05.37.46; Tue, 17 Nov 2020 05:38:09 -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=x6NYqaqW; 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 S1732454AbgKQNfS (ORCPT + 99 others); Tue, 17 Nov 2020 08:35:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:45854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732439AbgKQNfN (ORCPT ); Tue, 17 Nov 2020 08:35:13 -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 C8B002078E; Tue, 17 Nov 2020 13:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620113; bh=Zkure4hyDU7vk0/XAXYQaRhl+s3T3kxNQ6o1n5JAdHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x6NYqaqW9g8oP06RdqLZFrTtQBVB2iGUaXkyLuxiE5Ggn/JIlTIvARohWmudI7ktD mBg3rbTHuqH9eJGKB5qBB5RXNoeTJwYwayNqlEXYwW+vP//o5eQw3KskNtu3GedMSf kE34xU/H1j5Zo72pcVTYkQTzFD46SqfDJ07LdTy0= 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 111/255] nvme-tcp: avoid repeated request completion Date: Tue, 17 Nov 2020 14:04:11 +0100 Message-Id: <20201117122144.357668381@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 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 Signed-off-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 19f86ea547bbc..c0c33320fe659 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2168,7 +2168,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); } -- 2.27.0