Re: loop devices under SMP (2.1.106ac4)

Savochkin Andrey Vladimirovich (saw@msu.ru)
Tue, 23 Jun 1998 14:51:46 +0400


On Mon, Jun 22, 1998 at 05:46:27PM -0500, Shawn Leas wrote:
> On Mon, 22 Jun 1998, Rick Payne wrote:
>
> >
> > There appears to be a deadlock of some kind with loop devices under
> > 2.1.106-ac4 and SMP. Executing the following command locks my system dead:
> >
> > mount isoimage.raw -r -t iso9660 -o loop /mnt
> >
> > Running a non-SMP kernel and the above works a treat. The problem was also
> > present in 2.1.106-ac3 and -ac2, but these are the only kernels I've tried
> > since getting the SMP box, so it may well have existed in previous kernels.
> >
> > It looks like something is going awry inside ll_rw_block called from
> > loop.c's do_lo_request. A spinlock thing perhaps?
>
> How many times does this have to be rediscovered? You are very correct,
> and there was supposed to be a fix coming. This has not materialized.
>
> And yes, I believe it was a spinlock misuse thing.
>
> -Shawn
>
> > I'll continue looking at it, but if this rings any bells for anyone and
> > they get there before me, give me a shout.

Hi,

I've got a simple and stupid patch.
It revives loopback devices but can lead to more serious problems
because of IRQ playing.
You may try it if you're a brave person.

--- linux.orig/drivers/block/loop.c Sat May 16 16:16:51 1998
+++ linux/drivers/block/loop.c Thu Jun 11 16:30:05 1998
@@ -187,11 +187,15 @@
struct loop_device *lo;
struct buffer_head *bh;
struct request *current_request;
+ unsigned long flags;

+ save_flags(flags);
repeat:
INIT_REQUEST;
current_request=CURRENT;
CURRENT=current_request->next;
+ spin_unlock_irqrestore(&io_request_lock,flags);
+ __sti();
if (MINOR(current_request->rq_dev) >= MAX_LOOP)
goto error_out;
lo = &loop_dev[MINOR(current_request->rq_dev)];
@@ -274,11 +278,13 @@
offset = 0;
block++;
}
+ spin_lock_irq(&io_request_lock);
current_request->next=CURRENT;
CURRENT=current_request;
end_request(1);
goto repeat;
error_out:
+ spin_lock_irq(&io_request_lock);
current_request->next=CURRENT;
CURRENT=current_request;
end_request(0);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu