Commit 524225b7 authored by Jens Axboe's avatar Jens Axboe

[PATCH] blk_insert_request() buglet

blk_insert_request() unconditionally calls q->request_fn(q) regardless
of the plug state of the queue. This means that we could invoke
request_fn with a plugged queue, which is an invalid state.

Also fix a Jamesism style in there.
parent e5e91f86
...@@ -1737,9 +1737,9 @@ void blk_insert_request(request_queue_t *q, struct request *rq, ...@@ -1737,9 +1737,9 @@ void blk_insert_request(request_queue_t *q, struct request *rq,
/* /*
* If command is tagged, release the tag * If command is tagged, release the tag
*/ */
if(reinsert) { if (reinsert)
blk_requeue_request(q, rq); blk_requeue_request(q, rq);
} else { else {
int where = ELEVATOR_INSERT_BACK; int where = ELEVATOR_INSERT_BACK;
if (at_head) if (at_head)
...@@ -1751,7 +1751,10 @@ void blk_insert_request(request_queue_t *q, struct request *rq, ...@@ -1751,7 +1751,10 @@ void blk_insert_request(request_queue_t *q, struct request *rq,
drive_stat_acct(rq, rq->nr_sectors, 1); drive_stat_acct(rq, rq->nr_sectors, 1);
__elv_add_request(q, rq, where, 0); __elv_add_request(q, rq, where, 0);
} }
q->request_fn(q); if (blk_queue_plugged(q))
__generic_unplug_device(q);
else
q->request_fn(q);
spin_unlock_irqrestore(q->queue_lock, flags); spin_unlock_irqrestore(q->queue_lock, flags);
} }
......
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