Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp314084imm; Thu, 14 Jun 2018 21:04:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJAJB+A5cCH3OT5K2wtp1XvdwPv/5HyAsgmCp0hHAl2bzK2Wmq3W3/b4K9FNdYZ3a2JYykO X-Received: by 2002:a63:bd51:: with SMTP id d17-v6mr40906pgp.42.1529035458238; Thu, 14 Jun 2018 21:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529035458; cv=none; d=google.com; s=arc-20160816; b=RUe4PnA4gydnauFkAboDrX5rmIghp1uDcJZkxKZTQjZcRPrEK3WV0mu7xlx3PdTIWn jFIMNswIeYmjGZwnk843uonLRYyXs0U4fhlRXKJEyNMmUBEWrFWx6dVp31YrmpvHm2xw RVAWH1L5gsGlzIXGVZD34fUjUri0nclc1uvAKscfzk+Tlg0nVNBRbRFhD+syB2L/k94Q 2gxhwtIi5Y/WJ5fK0YaaUxmqOat7QZKe9iihL5zJz+q3d/FF/D4f1MXnSnVDc7ddQKZd mQITYv6+IArGIcN7DkSXwlTGJEEJcmQmGB6sfzNkrWyJ2cv+eB3pKksP23qEGwC0mxvL 2uug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=EK5/NMSvCynvoOMsYkOc3HXGmChaQWVApBkgjnNsxGU=; b=p+JIG2yDe0KtEVB0+yzGfHHQQ3Gm1o235n2Fog6TROBXx1cXouFeY80KQFL45nW1YL Ix9RVGxkl5wGFfn3hSJJUfARpIEzDYc0qrr/gf/agLpxylrf0w7kszUUSMdyDHwDucy7 UOKZ7F19mrtfA1ypQxliZAbVZFnO3763/xFGmFLfIAJdt1FmxOlB1ITipKWG5kpXLRIu V9tqkys6fJovVBHabu1JfArZIPElERQz5AjF7nj7bX3dr4TtqpHGJwKDvT5FE8oRYz+P nQm+QBjQNIEZIxgzCdNkMJ+VwzcKtHWSZhL7p+QJAYxL21LSYcMKYGOWzdZcyYyI/mPG Qfxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gB69DBtH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y23-v6si7291382pli.354.2018.06.14.21.03.53; Thu, 14 Jun 2018 21:04:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gB69DBtH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754165AbeFOEDQ (ORCPT + 99 others); Fri, 15 Jun 2018 00:03:16 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42783 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750765AbeFOEDO (ORCPT ); Fri, 15 Jun 2018 00:03:14 -0400 Received: by mail-wr0-f196.google.com with SMTP id w10-v6so8487457wrk.9; Thu, 14 Jun 2018 21:03:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=EK5/NMSvCynvoOMsYkOc3HXGmChaQWVApBkgjnNsxGU=; b=gB69DBtHLYGrJgKU2j7utepgfCCTgIBiuuHOAcd9Hr/qzVXFLZevyg5wG366mQTgG/ 89ZevSyhAzR0Dxtb2nkO3jM/MYFOURygFDuWH4+yYfuknYEaI/R56Z+rIQ295uBqyZg/ G44C6E+SwonQWwqDCIaaXp5nQ2EW7NpSVBHDOVoEt60f/6hqCFSVXa5Khj1LKkMD35ZY h3gopJL56QsBhoHxajjKjvHBzzZJ0QuoJwfNEQQBEEhH0PfcrxVV/6szk462UX9PBg+5 hmhsdeiW5vsCCf2bUlS+rBaimEtdm+78Ro48clQXE2cBSym9XLK//DdrQSWEssKh/Y+P mgVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=EK5/NMSvCynvoOMsYkOc3HXGmChaQWVApBkgjnNsxGU=; b=HBj+cXY9YijrOPkU50GA4cc/0PqqUmRNv9nxGXJ8dMn5nv4OvL3PsNKxE3WafywNdk 3qdMr/PtIlK0IrGs9oAVtFgpvgcEBJJse6PIjW2bCxxqfrMR5N8MHrISeWFlqZpzXa0r DQfg9siSzu2WKy6+ZY3nwIIITqNVpE2h6xZlqQDlgqfVFLgHhsmHTb3bWfcZyjPd9yyC 1OxGPrhfSC9VXLitI/HRieXRoiEJFEqFQTFcbFbHThtuAj+m1U6cnflwehvECkOMr9Oz d1g+zVjWSyO5WTA3KSqT0Y1MaGSJR/Pfp6Uptv5n1CmBir2UqWHwkJlXRm04zEDB7s6a JlnQ== X-Gm-Message-State: APt69E2l70NG5ZgCuZCqM19o9K7hgKwVUXuNKLC3c7lm1aBYfZm4GqeT QUr+o3BwN37NJMWhHhC/LhPv9XGIIRE2mByGkQc= X-Received: by 2002:adf:c7c3:: with SMTP id y3-v6mr15180wrg.230.1529035393563; Thu, 14 Jun 2018 21:03:13 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:97c6:0:0:0:0:0 with HTTP; Thu, 14 Jun 2018 21:03:12 -0700 (PDT) In-Reply-To: <7a77829a-ba5f-8975-edb0-ffdf25dc71d6@oracle.com> References: <1529027847-29085-1-git-send-email-jianchao.w.wang@oracle.com> <3dd3f82a-5b68-f039-3a8a-7c5fe4e24c3e@oracle.com> <3970fdc7-52d9-d05b-4118-059d48bf4f2d@oracle.com> <7a77829a-ba5f-8975-edb0-ffdf25dc71d6@oracle.com> From: Ming Lei Date: Fri, 15 Jun 2018 12:03:12 +0800 Message-ID: Subject: Re: [PATCH 1/2] block: export __blk_complete_request To: "jianchao.wang" Cc: Jens Axboe , Christoph Hellwig , James Bottomley , "Martin K. Petersen" , linux-block , Linux SCSI List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 15, 2018 at 11:26 AM, jianchao.wang wrote: > Hi Ming > > On 06/15/2018 11:20 AM, Ming Lei wrote: >> On Fri, Jun 15, 2018 at 11:04 AM, jianchao.wang >> wrote: >>> Hi Ming >>> >>> Thanks for your kindly response. >>> >>> On 06/15/2018 10:56 AM, Ming Lei wrote: >>>>>> IMO, ref-counter is just to fix the blk-mq req life recycle issue. >>>>>> It cannot replace the blk_mark_rq_complete which could avoid the race between >>>>>> timeout and io completion path. >>>>> The .timeout return BLK_EH_DONE doesn't always mean the request has been completed. >>>>> Such as scsi-mid layer, its .timeout callback return BLK_EH_DONE but the timed out >>>>> request is still in abort or eh process. What if a completion irq come during that ? >>>> For blk-mq, it is avoided by the atomic state change in >>>> __blk_mq_complete_request(), >>>> that is why I mentioned the question in my last reply. >>>> >>> >>> but blk_mq_check_expired doesn't do that. >>> do I miss anything ? >> >> Right, that is the difference between blk-mq and legacy now, > > Sorry, I cannot follow your point. > blk_mq_check_expired doesn't do a atmoc state change from IN-FLIGHT to COMPLETE. > __blk_mq_complete_request could still proceed to complete a timed out request > which is in scsi abort or eh process. Is it really OK ? That is the idea of Christoph's patchset of 'complete requests from ->timeout', then drivers need to cover race between timeout and normal completeion. But at least the request won't be completed twice because of the atomic state change in __blk_mq_complete_request(). So what is your real concern about blk-mq's timeout? Thanks, Ming