My OS is Slackware 13.1(2.6.33.4-smp).
I'm running losetup -d $dev in my custom script as the last line to free some loop device created in it. However, it not always works saying that the device is busy though nothing in my script works with it anymore. This script is being invoked many times one right after another. Sometimes the device is freed, sometimes not. But if I put a "sleep 2" before losetup -d $dev then no problem ever occurs. It seems that "losetup" needs some time or smth... (can't show you the output of losetup -a now, not at work right now)
Is there a way to force deletion of some loop device? Do you have any ideas?