Improve handling of loop devices
Improve handling of loop devices

Simply detaching a loop device on cleanup is a bit racy; It doesn't
guarantee the loopdevice is fully synced to the backing store and
finalized. The only way to really guarantee that is to first detach the
loop device (via LOOP_CLR_FD), which sets the Autoclear flag if the loop
device is still actually busy. Followed by trying to remove the loop
device which will only succeed once loop device is actually unbound.

Give the system about 60 seconds to sort itself out before giving up.

Signed-off-by: Sjoerd Simons <1371fd10dd05a897e5b55dc6ae4fbafa1f84c6ec@collabora.co.uk>

go-debos/debos,d4s/debos