Call sync before unmounting keeps the mount from being busy.
here is a bug associated with this patch because there is a workaround included. Calling sync to enable the unmounting... https://bugs.launchpad.net/diskimage-builder/+bug/1214388 Change-Id: I9d5a1f092fd8f3ae1c14de03dd516203baab4da3
This commit is contained in:
parent
473d08cb84
commit
1dea2f3524
@ -14,6 +14,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
function unmount_image () {
|
function unmount_image () {
|
||||||
|
# Calling sync before helps ensure the mount isn't busy when you unmount it.
|
||||||
|
# Previously observing having disk corruption issues; one possibility is
|
||||||
|
# qemu-nbd not flushing dirty pages on disconnect?
|
||||||
|
# https://bugs.launchpad.net/diskimage-builder/+bug/1214388
|
||||||
|
sync
|
||||||
|
|
||||||
# unmount from the chroot
|
# unmount from the chroot
|
||||||
# Don't use TMP_MOUNT_PATH here, it might not have been set.
|
# Don't use TMP_MOUNT_PATH here, it might not have been set.
|
||||||
local MOUNTS
|
local MOUNTS
|
||||||
@ -21,12 +27,6 @@ function unmount_image () {
|
|||||||
for M in $MOUNTS; do
|
for M in $MOUNTS; do
|
||||||
sudo umount -f $M || true
|
sudo umount -f $M || true
|
||||||
done
|
done
|
||||||
# give it a second (ok really 5) to umount XXX - why? should instead track
|
|
||||||
# the mount data / lsof etc.
|
|
||||||
sleep 5
|
|
||||||
# having disk corruption issues; one possibility is qemu-nbd not flushing
|
|
||||||
# dirty pages on disconnect?
|
|
||||||
sync
|
|
||||||
if [ -n "$EXTRA_UNMOUNT" ]; then
|
if [ -n "$EXTRA_UNMOUNT" ]; then
|
||||||
$EXTRA_UNMOUNT
|
$EXTRA_UNMOUNT
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user