mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-11 06:54:18 +00:00
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:
parent
2e6de3759c
commit
d233186900
@ -88,10 +88,7 @@ static void genode_blk_request(struct request_queue *q)
|
|||||||
|
|
||||||
/* stop_queue needs disabled interrupts */
|
/* stop_queue needs disabled interrupts */
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
local_irq_disable();
|
|
||||||
blk_stop_queue(q);
|
blk_stop_queue(q);
|
||||||
local_irq_restore(flags);
|
|
||||||
local_irq_enable();
|
|
||||||
|
|
||||||
dev->stopped = 1;
|
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
|
* This function is called with the request queue lock held, unlock to
|
||||||
* enable VCPU IRQs
|
* enable VCPU IRQs
|
||||||
*/
|
*/
|
||||||
spin_unlock_irq(q->queue_lock);
|
spin_unlock_irqrestore(q->queue_lock, flags);
|
||||||
/* block until new responses are available */
|
/* block until new responses are available */
|
||||||
down(&dev->queue_wait);
|
down(&dev->queue_wait);
|
||||||
spin_lock_irq(q->queue_lock);
|
spin_lock_irqsave(q->queue_lock, flags);
|
||||||
|
|
||||||
/* start_queue needs disabled interrupts */
|
/* start_queue needs disabled interrupts */
|
||||||
local_irq_save(flags);
|
|
||||||
local_irq_disable();
|
|
||||||
blk_start_queue(q);
|
blk_start_queue(q);
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
local_irq_enable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write) {
|
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) {
|
if (dev->stopped) {
|
||||||
dev->stopped = 0;
|
dev->stopped = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user