multiple loop-mounts of the same fs-file

Franck Lesage (lesage@lirskynet.insa-rouen.fr)
Mon, 30 Mar 1998 14:50:32 +0200 (MET DST)


Hello,

I tried to mount an ext2 fs-file with the loop feature under 2.0.33.
I typed 'mount -t ext2 -o loop blah /mnt' and 'mount -t ext2 -o loop blah /a'
ok, they both appear in /proc/mounts :

/dev/loop0 /mnt ext2 rw 0 0
/dev/loop3 /a ext2 rw 0 0

[root@lirskynet /proc]# umount /a
ioctl: LOOP_CLR_FD: Device or resource busy
umount: /root/toto: device is busy

So far, so good ...

[root@lirskynet /proc]# cat modules
loop 2 2 (autoclean)

The 'umount /mnt' is ok but the 'used-by' field is only decremented by 1
which makes the loop module resident in memory whereas the both loop-mounts
(/mnt and /a) are removed.

I'm surely wrong but it seems that since the /mnt and /a inodes are the same
when the two mounts are on, when we umount /mnt, free do a blkdev_release()
of this inode in loop_clr_fd() which cause the release of two inodes (and
thus the disparition of the *two* mounts) though there's only *one*
MOD_DEC_USE_COUNT in the loop module. In the end, the two mounts are
removed though only one module use counter is removed (I think :-)

Sorry for the (surely) possible lameness I said (due to the fact I
dont understand most the the kernel magic :-) even when I read the sources)

Regards,
Franck

PS: I hear ppl asking "why the hell does he want to mount twice the *same*
file ?" :-)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu