Re: loopback devices are not freeed on umount

Matthew Wilcox (Matthew.Wilcox@genedata.com)
Mon, 8 Mar 1999 16:18:35 +0100


Hans de Goede wrote:
> If I mount a floppy image or an iso image trough loopback for example:
> mount boot.img t -o loop=/dev/loop0
> and then umount it with:
> umount t
> or:
> umount /dev/loop0
> The loopback module usage count stays 1 in /proc/modules
> also I cannot mount another image thorugh /dev/loop0 cause it's still in
> use acording to the kernel.

this is intended behaviour and a userspace issue in any case. Let me
explain:

mount -o loop is a shortcut which actually does an intelligent "losetup"
followed by a "mount /dev/loopN". When you unmount it, it does not run
a "losetup -d". It should not, as I (for one) use losetup manually to
mess around with loop devices and I would not like unmount to delete my
loop devices for me.

Andries, how do you feel about an extension to mtab to have a "loop"
option in the options field so that unmount can know to delete it if it
was created by mount? I realise this won't work for people who symlink
/etc/mtab to /proc/mounts.

(Example:

/dev/loop0 /mnt/test ext2 rw 0 0
/dev/loop1 /mnt/test2 ext2 rw,loop 0 0

here, loop1 would be automatically deleted and loop0 would not be.)

-- 
Matthew Wilcox <willy@bofh.ai>
"I decry the current tendency to seek patents on algorithms.  There are
better ways to earn a living than to prevent other people from making use of
one's contributions to computer science."  -- Donald E. Knuth, TAoCP vol 3

- 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/