LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Tejun Heo <tj@kernel.org>, Sitsofe Wheeler <sitsofe@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	Stefan Haberland <sth@linux.vnet.ibm.com>,
	Jan Hoeppner <hoeppner@linux.vnet.ibm.com>,
	Bart Van Assche <Bart.VanAssche@wdc.com>
Subject: Re: [PATCH] blk-mq: Directly schedule q->timeout_work when aborting a request
Date: Mon, 2 Apr 2018 16:35:58 -0600	[thread overview]
Message-ID: <47e8098e-478e-542c-d447-8b8d03bda562@kernel.dk> (raw)
In-Reply-To: <20180402220458.GJ388343@devbig577.frc2.facebook.com>

On 4/2/18 4:04 PM, Tejun Heo wrote:
> Request abortion is performed by overriding deadline to now and
> scheduling timeout handling immediately.  For the latter part, the
> code was using mod_timer(timeout, 0) which can't guarantee that the
> timer runs afterwards.  Let's schedule the underlying work item
> directly instead.
> 
> This fixes the hangs during probing reported by Sitsofe but it isn't
> yet clear to me how the failure can happen reliably if it's just the
> above described race condition.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Reported-by: Sitsofe Wheeler <sitsofe@gmail.com>
> Reported-by: Meelis Roos <mroos@linux.ee>
> Fixes: 358f70da49d7 ("blk-mq: make blk_abort_request() trigger timeout path")
> Cc: stable@vger.kernel.org # v4.16
> Link: http://lkml.kernel.org/r/CALjAwxh-PVYFnYFCJpGOja+m5SzZ8Sa4J7ohxdK=r8NyOF-EMA@mail.gmail.com
> Link: http://lkml.kernel.org/r/alpine.LRH.2.21.1802261049140.4893@math.ut.ee
> ---
> Hello,
> 
> I don't have the full explanation yet but here's a preliminary patch.
> 
> Thanks.
> 
>  block/blk-timeout.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-timeout.c b/block/blk-timeout.c
> index a05e367..f0e6e41 100644
> --- a/block/blk-timeout.c
> +++ b/block/blk-timeout.c
> @@ -165,7 +165,7 @@ void blk_abort_request(struct request *req)
>  		 * No need for fancy synchronizations.
>  		 */
>  		blk_rq_set_deadline(req, jiffies);
> -		mod_timer(&req->q->timeout, 0);
> +		kblockd_schedule_work(&req->q->timeout_work);
>  	} else {
>  		if (blk_mark_rq_complete(req))
>  			return;

In any case, it's cleaner than relying on mod_timer(.., 0). If that
doesn't guarantee that the timer runs again, I can see how a race
with the running timer could prevent us from seeing the timeout
after an abort.

I'll apply this, thanks.

-- 
Jens Axboe

  reply	other threads:[~2018-04-02 22:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01 14:35 [BISECTED][REGRESSION] Hang while booting EeePC 900 Sitsofe Wheeler
2018-04-02 13:47 ` Bart Van Assche
2018-04-02 14:33 ` Jens Axboe
2018-04-02 17:32   ` Sitsofe Wheeler
2018-04-02 20:29     ` Tejun Heo
2018-04-02 21:02       ` Sitsofe Wheeler
2018-04-02 22:04         ` [PATCH] blk-mq: Directly schedule q->timeout_work when aborting a request Tejun Heo
2018-04-02 22:35           ` Jens Axboe [this message]
2018-04-06 20:06           ` Sasha Levin
2018-04-10 18:43           ` Martin Steigerwald
2018-04-10 20:46             ` Martin Steigerwald
2018-04-05  8:14       ` [BISECTED][REGRESSION] Hang while booting EeePC 900 Sitsofe Wheeler
2018-04-05 14:42         ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47e8098e-478e-542c-d447-8b8d03bda562@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=Bart.VanAssche@wdc.com \
    --cc=hoeppner@linux.vnet.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sitsofe@gmail.com \
    --cc=sth@linux.vnet.ibm.com \
    --cc=tj@kernel.org \
    --subject='Re: [PATCH] blk-mq: Directly schedule q->timeout_work when aborting a request' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).