Commit 6431d730 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] Fix blk_stop_queue bug

Benh saw some bugs where the queue would end up being in an invalid
state, and this could certainly explain one of them. We must not have a
stopped queue on the plug list, and blk_plug_device() right now will
happily plug a stopped queue.

We don't need to have it plugged either, blk_start_queue() will make
sure that request_fn gets run.
parent 26fdde3a
......@@ -1016,7 +1016,13 @@ static int ll_merge_requests_fn(request_queue_t *q, struct request *req,
void blk_plug_device(request_queue_t *q)
{
WARN_ON(!irqs_disabled());
if (!blk_queue_plugged(q)) {
/*
* don't plug a stopped queue, it must be paired with blk_start_queue()
* which will restart the queueing
*/
if (!blk_queue_plugged(q)
&& !test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags)) {
spin_lock(&blk_plug_lock);
list_add_tail(&q->plug_list, &blk_plug_list);
mod_timer(&q->unplug_timer, jiffies + q->unplug_delay);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment