linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH UPDATED] block: In blk_execute_rq_nowait, init rq->end_io before checking for dead queue.
@ 2012-06-09  0:10 Muthu Kumar
  2012-06-09 12:47 ` Bart Van Assche
  0 siblings, 1 reply; 14+ messages in thread
From: Muthu Kumar @ 2012-06-09  0:10 UTC (permalink / raw)
  To: Jens Axboe, Tejun Heo, Jej B, linux-kernel, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

Since the queue->lock case is taken care of in the following patch:

(http://www.spinics.net/lists/linux-scsi/msg59845.html [PATCH 1/4]
block: Fix race on request_queue.end_io invocations)

Updated the patch with just the end_io assignment before dead queue check.


-------------
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 <muthur@gmail.com>
CC: Tejun Heo <tj@kernel.org>
CC: Jens Axboe <axboe@kernel.dk>
CC: James Bottomley <James.Bottomley@hansenpartnership.com>

-------------
diff --git a/block/blk-exec.c b/block/blk-exec.c
index fb2cbd5..f8b00c7 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -53,6 +53,9 @@ void blk_execute_rq_nowait(struct request_queue *q,
struct gendisk *bd_disk,
        WARN_ON(irqs_disabled());
        spin_lock_irq(q->queue_lock);

+       rq->rq_disk = bd_disk;
+       rq->end_io = done;
+
        if (unlikely(blk_queue_dead(q))) {
                spin_unlock_irq(q->queue_lock);
                rq->errors = -ENXIO;
@@ -61,8 +64,6 @@ void blk_execute_rq_nowait(struct request_queue *q,
struct gendisk *bd_disk,
                return;
        }

[-- Attachment #2: blk-exec-assign-endio-before-queue-dead-check.patch --]
[-- Type: application/octet-stream, Size: 1164 bytes --]


-------------
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 <muthur@gmail.com>
CC: Tejun Heo <tj@kernel.org>
CC: Jens Axboe <axboe@kernel.dk>
CC: James Bottomley <James.Bottomley@hansenpartnership.com>

-------------
diff --git a/block/blk-exec.c b/block/blk-exec.c
index fb2cbd5..f8b00c7 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -53,6 +53,9 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
 	WARN_ON(irqs_disabled());
 	spin_lock_irq(q->queue_lock);
 
+	rq->rq_disk = bd_disk;
+	rq->end_io = done;
+
 	if (unlikely(blk_queue_dead(q))) {
 		spin_unlock_irq(q->queue_lock);
 		rq->errors = -ENXIO;
@@ -61,8 +64,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 */
-------------


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-06-22 18:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-09  0:10 [PATCH UPDATED] block: In blk_execute_rq_nowait, init rq->end_io before checking for dead queue Muthu Kumar
2012-06-09 12:47 ` Bart Van Assche
2012-06-09 23:57   ` Muthu Kumar
2012-06-10 17:40     ` Bart Van Assche
2012-06-11 17:33       ` Muthu Kumar
2012-06-11 21:23         ` Muthu Kumar
2012-06-18 22:42           ` Tejun Heo
2012-06-20 18:53             ` Bart Van Assche
2012-06-21  0:53               ` Muthu Kumar
2012-06-21  0:56                 ` Tejun Heo
2012-06-21  5:40                 ` Bart Van Assche
2012-06-21 21:40                   ` Muthu Kumar
2012-06-22  7:20                     ` Bart Van Assche
2012-06-22 18:05                       ` Muthu Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).