From f61ecb1053768a942f16e7d9bb61d56ef51b30fe Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Thu, 6 Dec 2012 15:21:02 +0100 Subject: [PATCH] L4lx: make block stub driver SMP safe (fix #514) We have to take the block queue's spin lock before invoking the interrupt routine, otherwise the AVL tree og Genode's block packet stream gets corrupted. --- ports-foc/src/drivers/genode_block.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports-foc/src/drivers/genode_block.c b/ports-foc/src/drivers/genode_block.c index e9f3fb74f..e7796aff9 100644 --- a/ports-foc/src/drivers/genode_block.c +++ b/ports-foc/src/drivers/genode_block.c @@ -141,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; @@ -173,8 +173,11 @@ static struct block_device_operations genode_blk_ops = { static irqreturn_t event_interrupt(int irq, void *data) { + unsigned long flags; struct genode_blk_device *dev = (struct genode_blk_device *)data; + spin_lock_irqsave(dev->queue->queue_lock, flags); genode_block_collect_responses(dev->idx); + spin_unlock_irqrestore(dev->queue->queue_lock, flags); return IRQ_HANDLED; }