* RFC:blk-exec-call-completion-if-queue-dead [was Q: blk_execute_rq_nowait() doesn't call completion in case of dead queue
@ 2012-06-06 21:24 Muthu Kumar
2012-06-07 2:40 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Muthu Kumar @ 2012-06-06 21:24 UTC (permalink / raw)
To: Jens Axboe, tj, James.Bottomley; +Cc: linux-kernel
How about this change?
diff --git a/block/blk-exec.c b/block/blk-exec.c
index fb2cbd5..6bf5c0b 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -56,8 +56,10 @@ void blk_execute_rq_nowait(struct request_queue *q, struct ge
if (unlikely(blk_queue_dead(q))) {
spin_unlock_irq(q->queue_lock);
rq->errors = -ENXIO;
- if (rq->end_io)
- rq->end_io(rq, rq->errors);
+ if (done)
+ done(rq, rq->errors);
+ else if (rq->end_io) //XXX Not sure if this check and end_io
+ rq->end_io(rq, rq->errors);
return;
}
Only one driver - sx8.c, doesn't set done() function and every one
else expects done() to be called with error.
Regards,
Muthu
On Wed, Jun 6, 2012 at 11:59 AM, Muthu Kumar <muthu.lkml@gmail.com> wrote:
> Jens, Tejun et al,
> blk_execute_rq() calls blk_execute_rq_nowait() with blk_end_sync_rq()
> as the completion (done) routine. And then waits for the completion().
>
>
> rq->end_io_data = &wait;
> blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
> ...
> ...
> wait_for_completion(&wait)
>
> But in blk_execute_rq_nowait() if the queue is dead, completion
> routine is not called. Shouldn't we have to call the above completion
> (done()) to wake up the wait_for_completion()?
>
>
> if (unlikely(blk_queue_dead(q))) {
> spin_unlock_irq(q->queue_lock);
> rq->errors = -ENXIO;
> if (rq->end_io)
> rq->end_io(rq, rq->errors);
> return;
> }
>
> Thanks.
>
> Regards,
> Muthu
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: RFC:blk-exec-call-completion-if-queue-dead [was Q: blk_execute_rq_nowait() doesn't call completion in case of dead queue
2012-06-06 21:24 RFC:blk-exec-call-completion-if-queue-dead [was Q: blk_execute_rq_nowait() doesn't call completion in case of dead queue Muthu Kumar
@ 2012-06-07 2:40 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2012-06-07 2:40 UTC (permalink / raw)
To: Muthu Kumar; +Cc: Jens Axboe, James.Bottomley, linux-kernel
On Wed, Jun 06, 2012 at 02:24:35PM -0700, Muthu Kumar wrote:
> How about this change?
>
> diff --git a/block/blk-exec.c b/block/blk-exec.c
> index fb2cbd5..6bf5c0b 100644
> --- a/block/blk-exec.c
> +++ b/block/blk-exec.c
> @@ -56,8 +56,10 @@ void blk_execute_rq_nowait(struct request_queue *q, struct ge
> if (unlikely(blk_queue_dead(q))) {
> spin_unlock_irq(q->queue_lock);
> rq->errors = -ENXIO;
> - if (rq->end_io)
> - rq->end_io(rq, rq->errors);
> + if (done)
> + done(rq, rq->errors);
> + else if (rq->end_io) //XXX Not sure if this check and end_io
> + rq->end_io(rq, rq->errors);
> return;
> }
>
> Only one driver - sx8.c, doesn't set done() function and every one
> else expects done() to be called with error.
Looks like the bug there is rq->rq_disk and rq->end_io assignments
happening after the queue_dead check. Just move the two lines before
queue_head check?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-07 2:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06 21:24 RFC:blk-exec-call-completion-if-queue-dead [was Q: blk_execute_rq_nowait() doesn't call completion in case of dead queue Muthu Kumar
2012-06-07 2:40 ` Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.