Re: bad: scheduling while atomic!

Jörn Engel
2003-06-15T14:10:13Z

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;
}