diff options
author | Shaohua Li <shaohua.li@intel.com> | 2011-05-18 05:22:43 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-05-18 06:24:03 -0400 |
commit | 3ec717b7ca4ee1d75d77e4f6286430d8f01d1dbd (patch) | |
tree | fcf1db152baea6270dd6c4dbdf6ff8dd15ad440f /block | |
parent | 9937a5e2f32892db0dbeefc2b3bc74b3ae3ea9c7 (diff) |
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 <shaohua.li@intel.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index a2e58eeb3549..3fe00a14822a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -316,8 +316,10 @@ EXPORT_SYMBOL(__blk_run_queue); | |||
316 | */ | 316 | */ |
317 | void blk_run_queue_async(struct request_queue *q) | 317 | void blk_run_queue_async(struct request_queue *q) |
318 | { | 318 | { |
319 | if (likely(!blk_queue_stopped(q))) | 319 | if (likely(!blk_queue_stopped(q))) { |
320 | __cancel_delayed_work(&q->delay_work); | ||
320 | queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); | 321 | queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); |
322 | } | ||
321 | } | 323 | } |
322 | EXPORT_SYMBOL(blk_run_queue_async); | 324 | EXPORT_SYMBOL(blk_run_queue_async); |
323 | 325 | ||