From 6431d73097db52ed7647dc0720cfdb593221b800 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 8 Sep 2003 20:15:58 -0700 Subject: [PATCH] [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. --- drivers/block/ll_rw_blk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 5a4d6a931ccd2..fa00e0152d1a5 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -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); -- 2.53.0