Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1257213rwl; Fri, 7 Apr 2023 12:31:52 -0700 (PDT) X-Google-Smtp-Source: AKy350b4naZgF8hiLA6XWLIxyVfwjdczxDcVyJIlh6d3Zb0yuCIgVUZlpTADeeR6dRxYFBRPMvIz X-Received: by 2002:a17:906:1145:b0:8c3:3439:24d9 with SMTP id i5-20020a170906114500b008c3343924d9mr449713eja.24.1680895911767; Fri, 07 Apr 2023 12:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680895911; cv=none; d=google.com; s=arc-20160816; b=fqsewOoJ4eDfT/z8S71tmmyaHtvC6VlKaSaO2EXxKtDCHOoENIrAKpQG5XpMGD+ROr 26ECEjWzibGkNom8RvUXMGQ7fBnfDgBFxv2vy2xwyrvsx4mNpWR/DthvSptVN1myU7Tm 4TS/w74u2XLm3zBNz2Di2EAji7WUhUyMXn2YWukBMu3NzX0PEj0eBom4fglDCor8PzeM ffZtmWHjA5cPVrhOcK/sd+5HOnMgGuBfTtH+cCiM/w/c6taXiprVjCK2dHP8yS+7vJay INbEcQt8UnLQJJUOQFQEYJItDTsV5lR9xLpHscw+mm8fD+1u/N5Y6tnPn3e+CnTvHUUh FemQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lQFr/eTG5PKOz8JxO+gbkJmWPAIh7Pr6SkFdj3NoNLY=; b=u6AOg4sdBwUceS3bEH27i1/sf3TpJQzzls7e2HjnF/CrvkRLp+K2CEeFkke++0G7pr ERzLVtNGtV4+lS/xH6d7P0/SyK0vOG3VKu+4608UajGilVKLD/iu22SvZrPzhqD03vtJ kByO33PUdjnCyZIfAMiWfY3zlhu6XtYLVXeclON5CXJsf5dhj29RpO+Qni15VwrkNQl+ 8ufeHMuHnJJHoSMedgRuCXsPaBbkibNeuy4C+hSnRmZk24u0vRzivuuMAbLa5mNh/tVR BNtkbpSkhr75ROabWiX2lrZCs4VbXi//nuVOBkd47rvIoXQNk6tRDIOfbPrb/h86hAAk U8sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E6x8fviM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk10-20020a170906b0ca00b00940e715a40dsi2894269ejb.408.2023.04.07.12.31.26; Fri, 07 Apr 2023 12:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E6x8fviM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbjDGTap (ORCPT + 99 others); Fri, 7 Apr 2023 15:30:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbjDGTal (ORCPT ); Fri, 7 Apr 2023 15:30:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B083A7D9B for ; Fri, 7 Apr 2023 12:30:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4ED596108C for ; Fri, 7 Apr 2023 19:30:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28326C433EF; Fri, 7 Apr 2023 19:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680895824; bh=3ywzi95ZmiScAxaAds75UKy6vqGW+xnG6LmWrRIr+BE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=E6x8fviM6g7mbuOCJ9TcclQ6RWAvhdNJDv0A1AAXoY68HnRvxycuAAiXOqVLzdy/3 +63WSI1xyX/KF6uvPfEssmGEt1vr9Ym2GbxqZHAePE8k8TmxJVilCEhW+i4laLRBgk g1IQamVkm/eQkwKgWYG/RQs0j8Lg6hvKTSnY1qV3EKiQjBnZAsDQfuxC4x7zne68La uH8sMiN8ZJX+VfnB1L8sJqhBbYGc9JpnIVDcxJJQwT8toNvAFmgFt2eccGeW/Zlgpy GJnmBnOdibL2k/iARUqtCErLXWH5TdJwt5eA9Unc9eWzjzsuTr24l6Qj2wnWIRNdmO al6dQyJxlfLdg== Date: Fri, 7 Apr 2023 13:30:21 -0600 From: Keith Busch To: Lei Lei2 Yin Cc: "axboe@fb.com" , "hch@lst.de" , Sagi Grimberg , "linux-nvme@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "cybeyond@foxmail.com" Subject: Re: [PATCH] nvme: fix double blk_mq_complete_request for timeout request with low probability Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 06, 2023 at 04:18:18PM +0000, Lei Lei2 Yin wrote: > 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