L4Linux: hold queue lock in block driver (fix #395)

When finishing a block request in the L4Linux block stub driver,
we#ve to hold the queue lock before using __blk_end_request_all, or
simply use blk_end_request_all instead. Moreover, this commit simplifies
the lock/unlock behaviour when the block queue has to be stopped, or resumed.
Thanks to I. Ismagilov for these suggestions.
This commit is contained in:
Stefan Kalkowski 2012-11-22 16:40:24 +01:00 committed by Norman Feske
parent 2e6de3759c
commit d233186900

View File

@ -88,10 +88,7 @@ static void genode_blk_request(struct request_queue *q)
/* stop_queue needs disabled interrupts */
local_irq_save(flags);
local_irq_disable();
blk_stop_queue(q);
local_irq_restore(flags);
local_irq_enable();
dev->stopped = 1;
@ -99,17 +96,14 @@ static void genode_blk_request(struct request_queue *q)
* This function is called with the request queue lock held, unlock to
* enable VCPU IRQs
*/
spin_unlock_irq(q->queue_lock);
spin_unlock_irqrestore(q->queue_lock, flags);
/* block until new responses are available */
down(&dev->queue_wait);
spin_lock_irq(q->queue_lock);
spin_lock_irqsave(q->queue_lock, flags);
/* start_queue needs disabled interrupts */
local_irq_save(flags);
local_irq_disable();
blk_start_queue(q);
local_irq_restore(flags);
local_irq_enable();
}
if (write) {
@ -147,7 +141,7 @@ genode_end_request(void *request, short write,
}
}
__blk_end_request_all(req, 0);
blk_end_request_all(req, 0);
if (dev->stopped) {
dev->stopped = 0;