From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D8ABC76196 for ; Fri, 7 Apr 2023 21:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230513AbjDGVe3 (ORCPT ); Fri, 7 Apr 2023 17:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjDGVe1 (ORCPT ); Fri, 7 Apr 2023 17:34:27 -0400 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 878952715 for ; Fri, 7 Apr 2023 14:34:25 -0700 (PDT) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-3f080fdb924so2465e9.1 for ; Fri, 07 Apr 2023 14:34:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680903264; x=1683495264; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Datt06y6QOn3vVdQaOHrLIlblRQOgkrxQaZSIY+FYG0=; b=wtSCevor2na2EU+0BL4aP5lAXeMl8Pz6E8mAU3SufailvvJ7u5Fx1SDVz7Yd8RMfWu qbJ99JQmqSwmPdx9lFwluvembSeDi/zQpbNoJW577vSFH1QYIfBRKnUwKuDf7aSHxA4k pAGX8g1Knr/ag9FIIoNSmkVUZq6XJbjHKyHmLCpES1pfUJmM3wfSaeYs+b9qfpmFIZlR 7+yx12UuebP2wWsFMdWZZ0w9KNZXRYS4eWtNIF9FoMRZFWeIesX7bBjd23hSVAOiGW5U MbPTblooWs2OZCoC+I4ZkdhhWLcRcNLzMeB+xkR6pfNKIY1p95adOYppPYzazmmLB5zX PlcQ== X-Gm-Message-State: AAQBX9ezxvxmllaPCWrjEL9S+hnhohhpnrjdldPLzNqtbn69cW+FyZow pJh4J5ZTWBBgrABYr4gjD1s= X-Google-Smtp-Source: AKy350baUMxCZkE2nsZcNtWR9Nkg/ifoAdbJKZh8R8Xpz+6OML1wgprg9hWp45VmnR6Dx/XJWz8FAg== X-Received: by 2002:a05:600c:1ca4:b0:3ed:d2ae:9adb with SMTP id k36-20020a05600c1ca400b003edd2ae9adbmr562659wms.0.1680903263903; Fri, 07 Apr 2023 14:34:23 -0700 (PDT) Received: from [10.100.102.14] (85.65.206.11.dynamic.barak-online.net. [85.65.206.11]) by smtp.gmail.com with ESMTPSA id t6-20020a05600c450600b003ee2a0d49dbsm9694305wmo.25.2023.04.07.14.34.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Apr 2023 14:34:23 -0700 (PDT) Message-ID: Date: Sat, 8 Apr 2023 00:34:22 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] nvme: fix double blk_mq_complete_request for timeout request with low probability Content-Language: en-US To: Keith Busch , Lei Lei2 Yin Cc: "axboe@fb.com" , "hch@lst.de" , "linux-nvme@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "cybeyond@foxmail.com" References: From: Sagi Grimberg In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c >> index 53ef028596c6..c1cc384f4f3e 100644 >> --- a/drivers/nvme/host/core.c >> +++ b/drivers/nvme/host/core.c >> @@ -450,8 +450,8 @@ bool nvme_cancel_request(struct request *req, void *data) >> dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device, >> "Cancelling I/O %d", req->tag); >> >> - /* don't abort one completed request */ >> - if (blk_mq_request_completed(req)) >> + /* don't abort one completed or idle request */ >> + if (blk_mq_rq_state(req) != MQ_RQ_IN_FLIGHT) >> return true; > > I was suspicious about this path too, and had the same change long ago, but > shelved it when I couldn't produce any errors there. But the change makes sense > to me! > > Reviewed-by: Keith Busch We need to change nvmf_complete_timed_out_request() too. Reviewed-by: Sagi Grimberg