[PATCH] Fix intermittent build failures due to busy loopback device
Hello,
Please accept this simple patch that fixes intermittent build failures due to busy loopback device by adding a 'sleep 1' statement before removing a loopback in the Losetup function in functions/losetup.sh. Similar fixes have been applied in the past to address this issue in other parts of the codebase and I believe this is the last remaining case meaning this should resolve this annoying intermittent failure once and for all.
Ideally, we should probably add a helper function to remove loopback devices that does the sleep for us instead of having sleeps in several places where we do losetup -d or even having Losetup sleep before returning to avoid this race condition for sure in all cases. However, I'll leave that improvement for another day.
Cheers,
--
Cody A.W. Somerville
Release Engineer
Foundations Team
Custom Engineering Solutions Group
Canonical OEM Services
Phone: +1 781 850 2087
Cell: +1 613 401 5141
Fax: +1 613 687 7368
Email: cody.somerville@canonical.com
=== modified file 'functions/losetup.sh'
--- functions/losetup.sh 2010-09-26 13:03:09 +0000
+++ functions/losetup.sh 2010-12-09 19:10:38 +0000
@@ -16,6 +16,7 @@
${LB_ROOT_COMMAND} ${LB_LOSETUP} "${DEVICE}" "${FILE}"
FDISK_OUT="$(${LB_FDISK} -l -u ${DEVICE} 2>&1)"
+ sleep 1
${LB_ROOT_COMMAND} ${LB_LOSETUP} -d "${DEVICE}"
LOOPDEVICE="$(echo ${DEVICE}p${PARTITION})"
Reply to: