-------- [PATCH] block: blk_execute_rq_nowait(): init rq->end_io before checking for dead queue. blk-exec.c: In blk_execute_rq_nowait(), if the queue is dead, call to done() routine is not made. That will result in blk_execute_rq() stuck in wait_for_completion(). Avoid this by initializing rq->end_io to done() routine before we check for dead queue. Signed-off-by: Muthukumar Ratty Tested-by: Bart Van Assche CC: Tejun Heo CC: Jens Axboe CC: James Bottomley -------- diff --git a/block/blk-exec.c b/block/blk-exec.c index fb2cbd5..00a72da 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c @@ -51,6 +51,10 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; WARN_ON(irqs_disabled()); + + rq->rq_disk = bd_disk; + rq->end_io = done; + spin_lock_irq(q->queue_lock); if (unlikely(blk_queue_dead(q))) { @@ -61,8 +65,6 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, return; } - rq->rq_disk = bd_disk; - rq->end_io = done; __elv_add_request(q, rq, where); __blk_run_queue(q); /* the queue is stopped so it won't be run */