refcnt of loop is wrong (was: "patch replacing /dev/root in /proc/mounts"

Tigran Aivazian (tigran@sco.COM)
Thu, 7 Oct 1999 16:04:35 +0100 (BST)


Hello Andries,

thanks for the "-o loop" tip - I didn't know.

Here is the typescript that shows the bug (the refcnt being wrong if you
use mount -o loop as opposed to losetup/losetup -d):

Script started on Thu Oct 7 16:48:10 1999
[root@elisha /root]# u
Linux elisha.london.sco.com 2.3.19 #10 SMP Thu Oct 7 10:33:06 BST 1999 i686 unknown
[root@elisha /root]# lsmod
Module Size Used by
tlan 19988 1 (autoclean)
[root@elisha /root]# file image
image: Linux/i386 ext2 filesystem
[root@elisha /root]# l image
-rw-r--r-- 1 root root 4096000 Oct 7 14:28 image
[root@elisha /root]# losetup /dev/loop0 image
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 1 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# mount -t ext2 /dev/loop0 /mnt
[root@elisha /root]# df
Filesystem Type 1k-blocks Used Available Use% Mounted on
/dev/root ext2 2478169 1683576 666475 72% /
/proc proc 0 0 0 - /proc
none devpts 0 0 0 - /dev/pts
/dev/loop0 ext2 3870 13 3657 0% /mnt
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 2 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# umount /mnt
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 1 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# losetup -d /dev/loop0
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 0 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# rmmod loop
[root@elisha /root]# lsmod
Module Size Used by
tlan 19988 1 (autoclean)
[root@elisha /root]# mount -t ext2 -o loop image /mnt
[root@elisha /root]# df
Filesystem Type 1k-blocks Used Available Use% Mounted on
/dev/root ext2 2478169 1683576 666475 72% /
/proc proc 0 0 0 - /proc
none devpts 0 0 0 - /dev/pts
/dev/loop0 ext2 3870 13 3657 0% /mnt
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 2 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# umount /mnt
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 1 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# mount -t ext2 -o loop image /mnt
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 3 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# umount /mnt
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 2 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# mount -t ext2 -o loop image /mnt
[root@elisha /root]# lsmod
Module Size Used by
loop 6952 4 (autoclean)
tlan 19988 1 (autoclean)
[root@elisha /root]# # see the refcnt going up? that's a bug to begin with...
[root@elisha /root]# Use "exit" to leave the shell.
[root@elisha /root]# exit

Script done on Thu Oct 7 16:51:03 1999

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/