Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp285252imm; Thu, 14 Jun 2018 20:21:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIQivu7M4ANCUJST3Ihof6qlzle+mlADWHQZW2fAYK4SURT9fvqnD1yVsheN3l4xGI+za+f X-Received: by 2002:a17:902:b488:: with SMTP id y8-v6mr5868157plr.157.1529032883367; Thu, 14 Jun 2018 20:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529032883; cv=none; d=google.com; s=arc-20160816; b=GS0tj6tQ1T2kQzUNhCPoJwq4dn5SmMSNPSBRhD8Z4sZOA47g94D3ruiv6lxG7NHuQi urBRum8qIvK22bXARouV5YcV/fs66EhEMjYN9mhqC4Gzzjrjkapid5MMVf0JGCPuD3M2 n+PvnkisyeybypgpGu81Yq3oCl4xf4fkESFGC/LuIjvr38Ywg9wt3FsXad6RAe5M1xkS UHKDCMiwZELaS7yXoeLdiYhdH27EO49uo3AISWBhjyfw/V/MssrKI1ZtsUuT8zgTAL9R xlYCtkBd8322RK8O4CsL9nvCGXrheQyOGGe3mtv+1vmUWEySad7nl0E2GXtf7L+wWumM i7bA== 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=8tLvUZheOGICUkJkecPK4j59o5xN6LbtCfGdBYQfuWM=; b=nu9310Cuuha5ssb3/H30LQNxeZLfAnVkXZvYNdo+lT8RSMzmk6rUUzH0SHkF7kKr9N 3xtG4ezpkU6rmykJV9RXfqoVxEA88sY1/Opp7dNf/cxhDTaKFRlb4x11y/LWp9NeGEQm aVH+fTjkRZbjLRVp7kxtvMFN988Sryxl3iD0JbAMT3XcJA+HqicAd02FtZXJI0hYFhRc +7A0vDzw54nyGGsqCvt9Rbu9fiFPLM/y8Unz9X80dQHluQhxU/A7lpSRPMvL4sL+cCeo cDo4KUw6jPATBAQTwh7Cnt4PEACFQXRFDAOKjYTFdgeXEnmmbpEmqt4r0HwSkhZrifOt p1iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Kp66YOci; 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 j77-v6si7486889pfa.57.2018.06.14.20.21.08; Thu, 14 Jun 2018 20:21:23 -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=Kp66YOci; 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 S965440AbeFODUp (ORCPT + 99 others); Thu, 14 Jun 2018 23:20:45 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38957 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964995AbeFODUn (ORCPT ); Thu, 14 Jun 2018 23:20:43 -0400 Received: by mail-wr0-f194.google.com with SMTP id w7-v6so8427269wrn.6; Thu, 14 Jun 2018 20:20:43 -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=8tLvUZheOGICUkJkecPK4j59o5xN6LbtCfGdBYQfuWM=; b=Kp66YOciG4H08KCPA7hNSCLQtWpm78kxpZk+7DbQ2W+ArxGoPxB1GLXqmtJq5IQmaN D8ZfsHrMWmX5dVtZ4lIcVo2aZBkBFam0oTAspp5LHuJ5bvH/KDPkYr8JwkLI2meMqOVb ntpiwb/zQciVW+cxHhNuZFeJprx/8VO5HxCLu8VsPsxtu8LD1Df28Shh7/fcUOVU3cIL WERbPvLLzqUWMngmlpoTwdss/Vjw3vu79GSowgYsaDNO7qsnwGwh9N2OdmBQZUClWmAN Vj1E/tb74Evmc3ne9nlU5O9e4X2TFp3cjKGiHt6phz04IzXwh6l7ASphqA08N9rRbf0b gtRQ== 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=8tLvUZheOGICUkJkecPK4j59o5xN6LbtCfGdBYQfuWM=; b=bfaqXPCkl/O382WJyzGdJQZdxvZtOpREqCZfOpgMWDaUF3iPC39Cb+JW6Jg7y6vbGi Dtm58k+o78QURZDMZ5WEXlwbkhmqT1VHUAk3IVV8zci3qf+RY4Xc/qkkh4QgPRobafXL q6mU8ZiXG4Nmy4yocEprDMUGRzNJhY63C7ZYm8m7dGJiudyIuRZ0vUoLiAA6IANxKV8o mxHIty26mbyMozU8Mq/bg1Lf2W5Zi9tCGPrODgNkZe9lVv8S+3bJhonu2rIRQ6rDManB KHENQFvilV5jIl6fiSGigUvNlCOXReXb48Ampbg9XiRrn7sGgXhhDCfai+KvU/2pCs3m oRsA== X-Gm-Message-State: APt69E2CroF+iLLXy3gBAJa++RyK2UnINUMXnRjYKeOUUQgOXZqHIuCl ElASCnvYm8b3YO3h8myV9r2RfPA1shE8A22UEHI= X-Received: by 2002:adf:e542:: with SMTP id z2-v6mr4543580wrm.111.1529032842478; Thu, 14 Jun 2018 20:20:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:97c6:0:0:0:0:0 with HTTP; Thu, 14 Jun 2018 20:20:40 -0700 (PDT) In-Reply-To: <3970fdc7-52d9-d05b-4118-059d48bf4f2d@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> From: Ming Lei Date: Fri, 15 Jun 2018 11:20:40 +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: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, 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