Skip to content

Commit 3ec717b

Browse files
Shaohua LiJens Axboe
Shaohua Li
authored and
Jens Axboe
committed
block: don't delay blk_run_queue_async
Let's check a scenario: 1. blk_delay_queue(q, SCSI_QUEUE_DELAY); 2. blk_run_queue_async(); the second one will became a noop, because q->delay_work already has WORK_STRUCT_PENDING_BIT set, so the delayed work will still run after SCSI_QUEUE_DELAY. But blk_run_queue_async actually hopes the delayed work runs immediately. Fix this by doing a cancel on potentially pending delayed work before queuing an immediate run of the workqueue. Signed-off-by: Shaohua Li <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 9937a5e commit 3ec717b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

block/blk-core.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,10 @@ EXPORT_SYMBOL(__blk_run_queue);
316316
*/
317317
void blk_run_queue_async(struct request_queue *q)
318318
{
319-
if (likely(!blk_queue_stopped(q)))
319+
if (likely(!blk_queue_stopped(q))) {
320+
__cancel_delayed_work(&q->delay_work);
320321
queue_delayed_work(kblockd_workqueue, &q->delay_work, 0);
322+
}
321323
}
322324
EXPORT_SYMBOL(blk_run_queue_async);
323325

0 commit comments

Comments
 (0)