Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp267054imm; Thu, 14 Jun 2018 19:56:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKM1w1K1LIrhx+J1W+w11tpOTWXPLKetm5jlZPq6V8YPZVvQ6OpfXr0W8PMC9rEOT8IK+N7 X-Received: by 2002:a17:902:b946:: with SMTP id h6-v6mr5700270pls.1.1529031407235; Thu, 14 Jun 2018 19:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529031407; cv=none; d=google.com; s=arc-20160816; b=TK2NqeMDtPHuxCnzndcdJqnKn7LdgyCApR2curjBdCkaUEt5bQ0wyBcOSqgtFyywYj M43cMH7bBq+TnMYLA9gJ70bFgdiNvxVt/TDd5ttKVCteaB9zJnhBhgl5oD3TdJhjXKeW U3BkWN5DD+8Klw1cmXvis1H28nvOYfdEoJfcNE5qwJ3yr16OggzlN5ZryEhyYyxknBTa hlMdCuWbPYoyMMI9wZVyXuKsrK6d2x6QXFeyQiDukQdGNga/rvXsnH8vHKkoKMEl0Fjj 6Br1CtAXxtt1jokw2RIFEuxwUogc35Uv5xm25imB8hDnREUZEdRZaYWYosn3Ds7wBG1n r65Q== 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=aUshg9zDeJA47JQ9vMsRdEYAbwTQMJ8I/12D21XButo=; b=xynuXZlCwFynzzsV3Hb7h3wCv5XdRM71fDFX9Op4TbnWxYiHXbW+CdZhIJyIp/VOSZ lY6IdsMmQzPvsokIbANQFcF9VTmtMTdD0peBrOJV5pD7opSWTKSOOekUnUGKWMOeD2qa s+5U11+Evh7TPppXAg1IESc5LvzfSyhQ/wRg8EPI+lsN/I5krtb11j6nJcjOZCQLCrDp LsUgUB83qidtWikzc+uaixntjDQN4EHhP7ag1cgnQ+jrvNr/EY4B0SH9gnYDYmUWYr4w Oc18Dnde9U1lOBmVuq/J2kHAYunsixGmHnrSxf1FHE3yRnw02VMdkCgnPnIQVOEDL/Au ryCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DkbDvNWC; 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 t3-v6si6933484plz.93.2018.06.14.19.56.31; Thu, 14 Jun 2018 19:56:47 -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=DkbDvNWC; 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 S965495AbeFOC4H (ORCPT + 99 others); Thu, 14 Jun 2018 22:56:07 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35240 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965123AbeFOC4G (ORCPT ); Thu, 14 Jun 2018 22:56:06 -0400 Received: by mail-wr0-f194.google.com with SMTP id l10-v6so8424085wrn.2; Thu, 14 Jun 2018 19:56:05 -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=aUshg9zDeJA47JQ9vMsRdEYAbwTQMJ8I/12D21XButo=; b=DkbDvNWCDlCpaEL+j5Bwflx8jsamTi+mXlOAk78QL7eGrzmOserrLmgCCQ/HcRU2f9 IcRxMPWuG3q7wbana0uo+np//CHrTW1Kw4NCACPwy1GFWke6+/SB5FJNX1Tu0BsNS97e cB2ozTgOQqHetr1yN3qEO1dpRfS53E8F3Mnfe0Snb2f3QWqQs8e8XLFbKPTn8FyJJb0n AITxMO+afeEuVHkVIUBZx7q9wQAaGb//MdfrhH7FoC7RIUFe0SDEKzSBdRxt2yKXOV1B l8TrV4b4mPxFJ+qYG9zLG31jZvBz8eMVESbEHalgU2zpcwLMTnclOMG3DASNVdL7A6cE 1xJA== 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=aUshg9zDeJA47JQ9vMsRdEYAbwTQMJ8I/12D21XButo=; b=fvHOSP1uwsnYCZgo3VBanGS1HvVPPZ37RbdHjUPEL3Lx93ZPLT251NO094Ghaj6zs5 jR7rOUi7+GIUh2MbVe+gceOIc3lYMw8WzPEA3o/J9LzpY+fXJazNGcypC581VHn9c15n JlDRwzPdEs+jDidcQfsR+Q1dVYVis+ICMb0H3n9cFG9m01BsSl9CSeM0B9PSu1hUjnl5 HWO9W3oYsCdfXb3+hxB9+3Bwmw0IyRctUPVEciGD/j3K8JBOrV88vZFIL+958CkKBTYM o2LWuuNWnw//6jfGbnv3PIG33sHPFKr0urgx+sA2RymQm8jAP7ezkXuH3hHStSQj9orL 8P0Q== X-Gm-Message-State: APt69E2t0xeoM5ncskbVlZJLKBb3L/baOJEuOues9XW35RpTTReSBqyW hvGxqYPxi+0/RESbOiEDD75aUsmik+pTbec17ss= X-Received: by 2002:adf:ac69:: with SMTP id v96-v6mr4224260wrc.5.1529031364800; Thu, 14 Jun 2018 19:56:04 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:97c6:0:0:0:0:0 with HTTP; Thu, 14 Jun 2018 19:56:03 -0700 (PDT) In-Reply-To: References: <1529027847-29085-1-git-send-email-jianchao.w.wang@oracle.com> <3dd3f82a-5b68-f039-3a8a-7c5fe4e24c3e@oracle.com> From: Ming Lei Date: Fri, 15 Jun 2018 10:56:03 +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 10:44 AM, jianchao.wang wrote: > > > On 06/15/2018 10:22 AM, jianchao.wang wrote: >> Hi Ming >> >> On 06/15/2018 10:17 AM, Ming Lei wrote: >>> On Fri, Jun 15, 2018 at 9:57 AM, Jianchao Wang >>> wrote: >>>> After f6e7d48 (block: remove BLK_EH_HANDLED), LLDD is responsible >>>> to complete the timed out request, however, for blk-legacy, the >>>> 'complete' is still marked, blk_complete_request will do nothing, >>>> we export __blk_complete_request for LLDD to complete the request >>>> in timeout path. >>>> >>>> Signed-off-by: Jianchao Wang >>>> --- >>>> block/blk-softirq.c | 1 + >>>> 1 file changed, 1 insertion(+) >>>> >>>> diff --git a/block/blk-softirq.c b/block/blk-softirq.c >>>> index 01e2b35..15c1f5e 100644 >>>> --- a/block/blk-softirq.c >>>> +++ b/block/blk-softirq.c >>>> @@ -144,6 +144,7 @@ void __blk_complete_request(struct request *req) >>>> >>>> local_irq_restore(flags); >>>> } >>>> +EXPORT_SYMBOL(__blk_complete_request); >>>> >>>> /** >>>> * blk_complete_request - end I/O on a request >>>> -- >>>> 2.7.4 >>>> >>> >>> Looks non-blk-mq timeout code need to convert to ref-counter >>> based approach too? >> >> 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 what if the timed-out request has been freed by EH? Then seems req's ref_counter is still needed for non-mq? Thanks, Ming Lei