Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp288776imm; Thu, 14 Jun 2018 20:26:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKJFT1XHawsbD78IfDNHyMVjeaUYc38Ln5RWp+fHj47LtzQeMkqMLU3RuDxarupD795MIb0 X-Received: by 2002:a63:78c6:: with SMTP id t189-v6mr4565359pgc.239.1529033198395; Thu, 14 Jun 2018 20:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529033198; cv=none; d=google.com; s=arc-20160816; b=KUa8Q2FOvgdKbKBCOJFMtPIeUmQBLjqXInK2jbHssOm4Vtk8gOvgAdXnX0+HfNq50u uMsUVRrJ1QyFhT2fDLmK+jozQgBoMUFl+sEfF49RS1bOlNBRl1cOEqs0Z2GcVg8tFPuc ezQoSfdfsxTJmE1SgZ2Uc/dDLW7bextgpE4B3w58mY9kz+YevxorT9S7Dq6usesSo3jc fqqNNahyqN23cHjVLVvdnFK1ZNa4lT15OvlX4J9QgcxLVKdgj6V4XILmq3LYS2m4GYw4 10wHDNH3tKaza/B+dG2g78qM0hZWT+enelTAiTsxprNdmrT62JXHEsZUBduasPdjinZR eWOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=J9wH4f886tWWO+5rMu8jwyDQrJv/nz0kPzmVKbMwUSU=; b=C6+oxyLUSY0CxOB/MKgj/N9w7yPH5VDEhQpAMfNwSB+mMdgd+QEorTQmWhqBGhT8mh /tjpwSl/pnI4bda1O2/ZCT8rDXV2243+xZKoLQZdqnKYUgjmDYeheQICF0ophV85gqKT yIGveJCZTXV9gjPumjADz4TVG1rYHJDOdp0HCSm4ukXTmXgS8Mvd4BJ/9vtE/6rqnZNq Ngw3vMbNXSsFSFeeg1dJzvggrc/ewKPGBGYoS7L8iIvjuXMBDNjDm48k8bzmRCvWxYqg XLk7yGfoC7y7d6NnJeUu+WqFv9Hu/TfgBEYHWMWqHEovyB/rb7lt+ReR0O+lPSjl0d8T NerQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=O+DSY72E; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63-v6si7123259pfx.61.2018.06.14.20.26.23; Thu, 14 Jun 2018 20:26:38 -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=@oracle.com header.s=corp-2017-10-26 header.b=O+DSY72E; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965528AbeFOD0C (ORCPT + 99 others); Thu, 14 Jun 2018 23:26:02 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:37022 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965123AbeFOD0B (ORCPT ); Thu, 14 Jun 2018 23:26:01 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5F3OwIb043276; Fri, 15 Jun 2018 03:25:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=J9wH4f886tWWO+5rMu8jwyDQrJv/nz0kPzmVKbMwUSU=; b=O+DSY72EeztUzj9cDrxcNwQ/0am5O1+eJvnczMAHRKMY15phnUW8mAxyvZwMRw6otEaY jdbFT5byKr9TASQw3F7oikQwO+xi2BWuKwtttfTCp11hbju35D/UtHcPfh8oltn96njM u0DnDC1Kb+0MDCJHIloaGRYzISSMDOrs38kb29lnDNW8BIfWpaa2QQ7VXbTaIH67lr2e Tb4hv6dz9aqTw3SN87loO0CqjE0SwVWjxF8hjhWguMVaiHHMwovbunjeRyFyA7Im0+7S sCNWTTD6J4qR05xfWDDcHZRkx/IPwkekWpdtj86x4JL0lHN3e1zibCjx2GAbWWN8DzoT 7w== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2jk0xrfca4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jun 2018 03:25:54 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5F3PrrG007531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jun 2018 03:25:53 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5F3PqPR028769; Fri, 15 Jun 2018 03:25:52 GMT Received: from [10.182.69.179] (/10.182.69.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Jun 2018 20:25:52 -0700 Subject: Re: [PATCH 1/2] block: export __blk_complete_request To: Ming Lei Cc: Jens Axboe , Christoph Hellwig , James Bottomley , "Martin K. Petersen" , linux-block , Linux SCSI List , Linux Kernel Mailing List 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> From: "jianchao.wang" Message-ID: <7a77829a-ba5f-8975-edb0-ffdf25dc71d6@oracle.com> Date: Fri, 15 Jun 2018 11:26:03 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8924 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806150034 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? Thanks Jianchao > then if scsi-mq > drivers can work well, they should work well with the following change in the > non-mq mode: > > diff --git a/block/blk-timeout.c b/block/blk-timeout.c > index 4b8a48d48ba1..9fce09d55652 100644 > --- a/block/blk-timeout.c > +++ b/block/blk-timeout.c > @@ -88,7 +88,6 @@ static void blk_rq_timed_out(struct request *req) > switch (ret) { > case BLK_EH_RESET_TIMER: > blk_add_timer(req); > - blk_clear_rq_complete(req); > break; > case BLK_EH_DONE: > /* > @@ -115,8 +114,7 @@ static void blk_rq_check_expired(struct request > *rq, unsigned long *next_timeout > /* > * Check if we raced with end io completion > */ > - if (!blk_mark_rq_complete(rq)) > - blk_rq_timed_out(rq); > + blk_rq_timed_out(rq); > } else if (!*next_set || time_after(*next_timeout, deadline)) { > *next_timeout = deadline; > *next_set = 1; > > > Thanks, > Ming Lei >