Today I examined this more closely, and to my very great surprise I found that when such a file is unmounted, the loop device is not freed from the file. It has been the standard behaviour of Linux ever since loop devices were introduced, that when you execute a 'umount' to unmount such a file, the corresponding loop device is also freed. However the two kernels 126.96.36.199 and 188.8.131.52 that I tested do not free the loop device.
Just to be sure, I also tested the latest Puppy built with 184.108.40.206 kernel, and the loop device did get freed.
This is a major change, and could break many scripts. Fortunately in Puppy /bin/umount is a script, so I can put in a fix, 'losetup -d /dev/<loop device>', unless any script calls the binary executables 'busybox umount' or 'umount-FULL' directly.
Before implementing such a fix, I thought it best to come online and do a search to see if there is any discussion about this. Strangely enough, I can't find anything much.
I wondered if there might be a kernel configure option, so I looked at the .config file that I used to compile 220.127.116.11, but no, there's nothing I can see that would be relevant.
I am very surprised. Quite a fundamental change, and I don't recall reading anything about it, though I watch the kernel announcements. Well, I guess I will just have to put a fix into the 'umount' script.
Thinking about it a bit more, the Busybox umount applet docs state that the default behaviour is to free the loop device, whereas the '-D' option will prevent it from being freed. But, it no longer works that way.
Comments:Posted on 10 Aug 2009, 21:22 by linuxcbon
I read loop is a module now.
you need to modprobe loop first, to be able to mount it.
Posted on 10 Aug 2009, 22:11 by BarryK
Loop device freed
Ha ha, the light came on!
I have discovered the problem is with Busybox. I am using Busybox from svn, 2009-07-25, and its umount applet has been made more compatible with the full umount.
The older Busybox, that I was using until recently, had default to free a loop device, unless the '-D' option was used. However, the full umount works the other way, default not to free the loop device, and option '-d' is required to free it.
In the above post, I stated that I checked with the 18.104.22.168 kernel, but in fact that build still has the older Busybox.
I want the old behaviour, to free loop devices by default, so I have added '-d' into the 'umount' script. Problem solved.