removing a mounted loopback file works

Tril (dem@tunes.org)
Thu, 1 Apr 1999 15:34:14 -0800 (PST)


I am using kernel 2.2.4 and mount-2.9i. I have a file slink1-i386.raw
(iso image). I can mount the file successfully using "mount
slink1-i386.raw /mnt -o loop" using /dev/loop0.

But then I can remove the file slink1-i386.raw while it is mounted. After
removing it, it's still listed as in use by mtab, /proc/mounts, and
losetup /dev/loop0, and I can still access the filesystem through /mnt.

If I try to unmount it then it takes longer than if I had not removed the
file.

I assume that /mnt is reading into unallocated inodes, and I assume that I
could cause corrupt "ls" listings by filling up my disk (to ensure the
inodes that were taken up by the mounted file are overwritten). I didn't
try doing this because I have no idea what other damage might occur.

I think the correct behavior is for "rm" to return an error (permission
denied, or some other error) if I try to remove the last (hard) link to a
mounted file.

David Manifold <dem@tunes.org>
This message is placed in the public domain.

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