Automatic deletion of loopback device upon umount?

ralda at gmx.de ralda at gmx.de
Fri Apr 6 06:20:46 UTC 2012


Hi Florian !

> 1) loopback mount "foo" to mount /bar
> 2) umount /bar
> 3) append new files and re-generate the "foo" cramfs image
> 4) loopback mount "foo" to mount /bar
> 5) the contents of /bar are the same as in 1) and not 3)

> Obviously using umount -d in 2) fixes the issue, but I was wondering 
> whether it would not be preferable to unconditionnaly delete the 
> loopback device upon umount? util-linux does this actually, so other 
> users might also be puzzled by such a case.

I hit that too, some time ago, not cramfs but squashfs and ISO images.
That was the reason I added an "alias umount='umount -d'" to
my /etc/profile and added the "-d" to all umounts in scripts.

IMHO it would be better to reverse definition of the "-d" option to
umount and do NOT delete the loop device if option gets specified and
drop/delete it in the default case.

--
Harald


More information about the busybox mailing list