test/btrfs.sh: fix cleanup
test/btrfs.sh: fix cleanup

Every time I run this test, I get a non-freed loopX device, and so
it all piles up like this:

 # losetup --all
 /dev/loop0: [fc01]:263347 (/dev/loop0)
 /dev/loop1: [fc01]:263352 (/dev/loop1)
 /dev/loop2: [fc01]:786470 (/root/mosaic/test/btrfs.img)
 /dev/loop3: [fc01]:805861 (/root/mosaic/test/btrfs.img)
 /dev/loop4: [fc01]:805863 (/root/mosaic/test/btrfs.img)
 /dev/loop5: [fc01]:805864 (/root/mosaic/test/btrfs.img)
 /dev/loop6: [fc01]:805866 (/root/mosaic/test/btrfs.img)
 /dev/loop7: [fc01]:805867 (/root/mosaic/test/btrfs.img)

I suspected blkid(1) and tried using lsof to figure out who's holding
the device, but lsof always shows nothing, so it might be the kernel.

Anyway, we need to clean up after our tests, so this patch implements
such a cleanup with timeouts added and proper retries.

Signed-off-by: Kir Kolyshkin <c0159612b0ef32139322233232df1a0d189c4b9b@openvz.org>

xemul/mosaic,xemul/mosaic,kolyshkin/mosaic,kolyshkin/mosaic,kolyshkin/mosaic,xemul/mosaic