Re: bad: scheduling while atomic!

Jörn Engel (joern@wohnheim.fh-wedel.de)
Sun, 15 Jun 2003 16:23:55 +0200


On Sun, 15 June 2003 14:29:50 +0100, Russell King wrote:
>
> This instance seems to be caused by the following code in
> drivers/mtd/mtd_blkdevs.c:
>
> while (!tr->blkcore_priv->exiting) {
> spin_lock_irq(rq->queue_lock);
> ...
> spin_unlock_irq(rq->queue_lock);
> ...
> spin_lock_irq(rq->queue_lock);
> ...
> }
>
> It would be useful if we could balance the spin_locks with the
> spin_unlocks. 8)

How about this mindless guess?

Jörn

-- 
It's just what we asked for, but not what we want!
-- anonymous

--- linux-2.5.71/drivers/mtd/mtd_blkdevs.c~mtd_spinlocks 2003-06-15 16:05:05.000000000 +0200 +++ linux-2.5.71/drivers/mtd/mtd_blkdevs.c 2003-06-15 16:19:43.000000000 +0200 @@ -93,14 +93,13 @@ recalc_sigpending(); spin_unlock_irq(&current->sighand->siglock); + spin_lock_irq(rq->queue_lock); while (!tr->blkcore_priv->exiting) { struct request *req; struct mtd_blktrans_dev *dev; int res = 0; DECLARE_WAITQUEUE(wait, current); - spin_lock_irq(rq->queue_lock); - req = elv_next_request(rq); if (!req) { @@ -112,6 +111,7 @@ schedule(); remove_wait_queue(&tr->blkcore_priv->thread_wq, &wait); + spin_lock_irq(rq->queue_lock); continue; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/