mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
blk-mq: make blk_abort_request() trigger timeout path
With issue/complete and timeout paths now using the generation number and state based synchronization, blk_abort_request() is the only one which depends on REQ_ATOM_COMPLETE for arbitrating completion. There's no reason for blk_abort_request() to be a completely separate path. This patch makes blk_abort_request() piggyback on the timeout path instead of trying to terminate the request directly. This removes the last dependency on REQ_ATOM_COMPLETE in blk-mq. Note that this makes blk_abort_request() asynchronous - it initiates abortion but the actual termination will happen after a short while, even when the caller owns the request. AFAICS, SCSI and ATA should be fine with that and I think mtip32xx and dasd should be safe but not completely sure. It'd be great if people who know the drivers take a look. v2: - Add comment explaining the lack of synchronization around ->deadline update as requested by Bart. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Asai Thambi SP <asamymuthupa@micron.com> Cc: Stefan Haberland <sth@linux.vnet.ibm.com> Cc: Jan Hoeppner <hoeppner@linux.vnet.ibm.com> Cc: Bart Van Assche <Bart.VanAssche@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -156,12 +156,17 @@ void blk_timeout_work(struct work_struct *work)
|
||||
*/
|
||||
void blk_abort_request(struct request *req)
|
||||
{
|
||||
if (blk_mark_rq_complete(req))
|
||||
return;
|
||||
|
||||
if (req->q->mq_ops) {
|
||||
blk_mq_rq_timed_out(req, false);
|
||||
/*
|
||||
* All we need to ensure is that timeout scan takes place
|
||||
* immediately and that scan sees the new timeout value.
|
||||
* No need for fancy synchronizations.
|
||||
*/
|
||||
req->deadline = jiffies;
|
||||
mod_timer(&req->q->timeout, 0);
|
||||
} else {
|
||||
if (blk_mark_rq_complete(req))
|
||||
return;
|
||||
blk_delete_timer(req);
|
||||
blk_rq_timed_out(req);
|
||||
}
|
||||
|
Reference in New Issue
Block a user