Skip to contentSkip to conversation

report bug: System reboots when accessing a loop-device over a second loop-device with 2.4.2-ac7

DISCUSSION Mario Hermann 2 participants 9 messages Mar 1, 2001 – Mar 3, 2001 Block layer

lore
Share & tools
lore
#0 lore raw

Hello!

I tried the following commands with 2.4.2-ac7:

losetup /dev/loop0 test.dat
losetup /dev/loop1 /dev/loop0
mke2fs /dev/loop1

My System reboots immediatly. I tried it with 2.4.2-ac4,ac5 too -> same effect.

With 2.4.2 it hangs immediatly.

Hope that helps.

Thanks

Mario

#1 lore raw
Quoted 10 lines · Mario Hermann

Hello!

I tried the following commands with 2.4.2-ac7:

losetup /dev/loop0 test.dat
losetup /dev/loop1 /dev/loop0
mke2fs /dev/loop1

My System reboots immediatly. I tried it with 2.4.2-ac4,ac5 too -> same effect.

Oops, will take a look.

Signature · 1 line
Jens Axboe
#2 lore raw
In reply to Mario Hermann
Quoted 10 lines · Mario Hermann

I tried the following commands with 2.4.2-ac7:

losetup /dev/loop0 test.dat
losetup /dev/loop1 /dev/loop0
mke2fs /dev/loop1

My System reboots immediatly. I tried it with 2.4.2-ac4,ac5 too -> same effect.

With 2.4.2 it hangs immediatly.

This should make it work again.

Signature · 1 line
Jens Axboe
block/loop.c renamed from opt/kernel/linux-2.4.2-ac7/drivers/block/loop.c +2 -2
@@ -397,10 +397,10 @@
 	if (!buffer_locked(rbh))
 		BUG();
 
-	if (MINOR(rbh->b_dev) >= max_loop)
+	if (MINOR(rbh->b_rdev) >= max_loop)
 		goto out;
 
-	lo = &loop_dev[MINOR(rbh->b_dev)];
+	lo = &loop_dev[MINOR(rbh->b_rdev)];
 	spin_lock_irq(&lo->lo_lock);
 	if (lo->lo_state != Lo_bound)
 		goto inactive;
#4 lore raw
In reply to Mario Hermann

Hello!

Quoted 8 lines · Jens Axboe
Quoted 6 lines · Mario Hermann

I tried the following commands with 2.4.2-ac7:

losetup /dev/loop0 test.dat
losetup /dev/loop1 /dev/loop0
mke2fs /dev/loop1

Quoted 6 lines
Quoted 4 lines

My System reboots immediatly. I tried it with 2.4.2-ac4,ac5 too -> same effect.

With 2.4.2 it hangs immediatly.

This should make it work again.

There is another small bug with the loop over loop problem. Now it works fine for
files but not for Devices:

losetup /dev/loop0 /dev/sr1
losetup /dev/loop1 /dev/loop0
dd if=/dev/loop1 of=test.dat bs=2048 count=1024

Makes dd hang. (BTW: /dev/sr1 is a CD-ROM)

Tried the same on /dev/hda1, /dev/sda1 with 2.4.2-ac7-your_patch and with 2.4.2-ac8.

BTW: Did extensiv testing with and without the crypto patches. And all other tests worked fine! :-)

--
Mario Hermann

#5 lore raw
In reply to Mario Hermann
Quoted 17 lines · Mario Hermann
Quoted 6 lines
Quoted 6 lines

I tried the following commands with 2.4.2-ac7:

losetup /dev/loop0 test.dat
losetup /dev/loop1 /dev/loop0
mke2fs /dev/loop1

Quoted 6 lines
Quoted 4 lines

My System reboots immediatly. I tried it with 2.4.2-ac4,ac5 too -> same effect.

With 2.4.2 it hangs immediatly.

This should make it work again.

There is another small bug with the loop over loop problem. Now it works fine for
files but not for Devices:

Quoted 8 lines

losetup /dev/loop0 /dev/sr1
losetup /dev/loop1 /dev/loop0
dd if=/dev/loop1 of=test.dat bs=2048 count=1024

Makes dd hang. (BTW: /dev/sr1 is a CD-ROM)

Tried the same on /dev/hda1, /dev/sda1 with 2.4.2-ac7-your_patch and with 2.4.2-ac8.

I must admit that I haven't tried loop-over-loop at all really, I'll make a note to look at this tonight.

Quoted 2 lines

BTW: Did extensiv testing with and without the crypto patches. And all other tests worked fine! :-)

Great.

Signature · 1 line
Jens Axboe
#6 lore raw
In reply to Mario Hermann
Quoted 7 lines · Mario Hermann

There is another small bug with the loop over loop problem. Now it works fine for
files but not for Devices:

losetup /dev/loop0 /dev/sr1
losetup /dev/loop1 /dev/loop0
dd if=/dev/loop1 of=test.dat bs=2048 count=1024

Pending miscount, this should fix it.

Signature · 1 line
Jens Axboe
block/loop.c renamed from opt/kernel/linux-2.4.2-ac8/drivers/block/loop.c +1 -3
@@ -307,6 +307,7 @@
 		lo->lo_bh = lo->lo_bhtail = bh;
 	spin_unlock_irqrestore(&lo->lo_lock, flags);
 
+	atomic_inc(&lo->lo_pending);
 	up(&lo->lo_bh_mutex);
 }
 
@@ -404,7 +405,6 @@
 	spin_lock_irq(&lo->lo_lock);
 	if (lo->lo_state != Lo_bound)
 		goto inactive;
-	atomic_inc(&lo->lo_pending);
 	spin_unlock_irq(&lo->lo_lock);
 
 	if (rw == WRITE) {
@@ -452,8 +452,6 @@
 	return 0;
 
 err:
-	if (atomic_dec_and_test(&lo->lo_pending))
-		up(&lo->lo_bh_mutex);
 	loop_put_buffer(bh);
 out:
 	buffer_IO_error(rbh);
#7 lore raw
In reply to Mario Hermann

Hello!

Quoted 11 lines · Jens Axboe
Quoted 7 lines · Mario Hermann

There is another small bug with the loop over loop problem. Now it works fine for
files but not for Devices:

losetup /dev/loop0 /dev/sr1
losetup /dev/loop1 /dev/loop0
dd if=/dev/loop1 of=test.dat bs=2048 count=1024

Pending miscount, this should fix it.

Ok, I did some testing again. What I found:

Without crypto: Everything works good!

With crypto:

I used the ciphers: idea,serbent, aes, blowfish(with small patch in cipher-blowfish send somewhere in the past)

Only 2.4.2-ac8 Material: Everything is ok.

With old 2.2-Material:

Encrypted in the way:

losetup -e blowfish /dev/loop0 ./test.file
losetup -e serpent /dev/loop1 /dev/loop0

It works perfect too! :-)

But with old 2.2 - Material stored on DVD-RAM.

losetup -e blowfish /dev/loop0 /dev/sr3
lsoetup -e serpent /dev/loop1 /dev/loop0

it doesn't work.

Just garbage comes out of the loop-device.
Both, the file on the harddisk and the DVD-RAM are made with 2.2.16 an patch-int-2.2.16.9 and are working
there perfectly.

I guess that the problem has maybe something to do with the logical block number.

Well, for me was the HD-File important to work under 2.4 (DB-on it...)

So great thx from me!

Hope my testing will help in some way. (will do some more monday afternoon)

---
Mario Hermann

#8 lore raw
In reply to Mario Hermann
Quoted 6 lines · Mario Hermann

But with old 2.2 - Material stored on DVD-RAM.

losetup -e blowfish /dev/loop0 /dev/sr3
lsoetup -e serpent /dev/loop1 /dev/loop0

it doesn't work.

(replied to Mario earlier, for reference here's the patch).

Yet another miscount and IV off, I apparently missed the latter when the other IV calculations were fixed. I've verified block crypto here now.

Signature · 1 line
Jens Axboe
block/loop.c renamed from opt/kernel/linux-2.4.2-ac10/drivers/block/loop.c +1 -2
@@ -345,8 +345,6 @@
 		struct buffer_head *rbh = bh->b_private;
 
 		rbh->b_end_io(rbh, uptodate);
-		if (atomic_dec_and_test(&lo->lo_pending))
-			up(&lo->lo_bh_mutex);
 		loop_put_buffer(bh);
 	} else
 		loop_add_bh(lo, bh);
@@ -479,6 +477,7 @@
 
 		IV = (bh->b_rsector / (bh->b_size >> 9));
 		IV += lo->lo_offset / bh->b_size;
+		IV >>= 2;
 
 		ret = lo_do_transfer(lo, READ, bh->b_data, rbh->b_data,
 				     bh->b_size, IV);