RE: z-Bug in loop device?

Ray Van Tassle-CRV004 (Ray_Van_Tassle-CRV004@email.mot.com)
Thu, 20 Mar 1997 8:38:35 -0600


I seem to recall a patch some time ago to fix loop's "re-entrancy" problem.
This sounds like it. Maybe the patch never made it into a release.
________________________________________________________
To: linux-kernel@vger.rutgers.edu@INTERNET
From: vincent@waw.com@INTERNET on Wed, Mar 19, 1997 5:57 PM
Subject: z-Bug in loop device?

Hello,

I can mount a disk image through a loop device. But if this disk
image contains another disk image that I try to mount through another loop
device, mount hangs up when called with "-o loop" :-(( It works if I call
losetup before and specify /dev/loop? as mount device.

Below, I explain all the steps to reproduce the bug.
Be sure to umount all but the necessaries partitions before the test
(or remount most of all read-only) because the only way to reboot will
be to press the "Reset" button. Further mounts hangup as well as sync,
halt, reboot... ;-)

(The same output is reproductible with Linux 2.0.29 and 2.1.29 with mount
2.5l and mount 2.6d, on both i386 and sparc)

---- create & mount the first disk image ----
# dd if=/dev/zero of=/tmp/part1 bs=1k count=1k
# losetup /dev/loop0 /tmp/part1
# mke2fs /dev/loop0 1024
# mount /dev/loop0 /mnt

---- create & mount a second disk image inside the first one ----
# dd if=/dev/zero of=/mnt/part2 bs=1k count=512
# losetup /dev/loop1 /mnt/part2
# mke2fs /dev/loop1 512
# mount /dev/loop1 /mnt2

---- show infos: OK ----
# mount
...
/dev/loop0 on /mnt type ext2 (rw)
/dev/loop1 on /mnt2 type ext2 (rw)

---- clean up in reverse order ----
# umount /mnt2
# losetup -d /dev/loop1
# umount /mnt
# losetup -d /dev/loop0

**** now mount these disk images without losetup facility ****
# mount -o loop /tmp/part1 /mnt
# mount -o loop /mnt/part2 /mnt2
....mount hangs :-((....
(and any further mount, umount, sync commands will)

---- from another tty ----
# ps -x | grep mount
1615 1 D 0:00 mount -o loop /mnt/part2 /mnt2

---------------------

Of course, one could say "If it works when losetup is used, then use
it every time", but I think it shouldn't hang like this anyway... ;)

Cordialement;

--
-     ** Linux **         +-------------------+             ** WAW **     -
-  vincent@debian.org     | RENARDIAS Vincent |          vincent@waw.com  -
-  Debian/GNU Linux       +-------------------+      http://www.waw.com/  -
-  http://www.debian.org/           |            WAW  (33) 4 91 81 21 45  -
-                                   |         Luminy  (33) 4 91 82 85 32  -
---------------------------------------------------------------------------