Skip to content

Commit

Permalink
blk-mq: Directly schedule q->timeout_work when aborting a request
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reported-by: Sitsofe Wheeler <[email protected]>
Reported-by: Meelis Roos <[email protected]>
Fixes: 358f70d ("blk-mq: make blk_abort_request() trigger timeout path")
Cc: [email protected] # v4.16
Link: http://lkml.kernel.org/r/CALjAwxh-PVYFnYFCJpGOja+m5SzZ8Sa4J7ohxdK=r8NyOF-EMA@mail.gmail.com
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
htejun authored and axboe committed Apr 2, 2018
1 parent a5040c2 commit bc6d65e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/blk-timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,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;
Expand Down

0 comments on commit bc6d65e

Please sign in to comment.