Unmount internal mounts on finalise errors
This is only one line, but it takes a lot to untangle ... basically the current "correct" path is: --- mk_build_dir() -> sets trap trap_cleanup EXIT ... stuff .. mount_proc_dev_sys -> mounts $TMP_MOUNT_PATH/<proc,dev.sysfs> pre-finalise.d finalise.d unmount_image $TMP_BUILD_DIR/mnt # nb == $TMP_MOUNT_PATH -> unmount_dir() -> recursive unmount everything inside TMP_MOUNT_PATH TMP_IMAGE_PATH=$(dib-block-device getval image-path) export TMP_IMAGE_PATH dib-block-device umount dib-block-device cleanup ... actually cleanup directories ... --- Our current failure exit trap does: --- dib-block-device umount unmount_image ... --- Note this is the *opposite* of what is done in the correct exit path. In the failure case, if a script fails in the finalise stages it leads to /proc, /sys, /dev etc. still being mounted inside the image; the "dib-block-device umount" call doesn't know anything about these mounts and tries to unmount the parent directory, and we get a hard failure with a busy mount, and all the mounts are subsequently leaked. Note that "unmount_dir", which is ultimately called by "unmount_image", already knows to skip those mounts that "dib-block-device umount" manages (this is the DIB_MOUNTPOINTS list). This is further evidence it should be called *before* the dib-block-device umount. Change-Id: Ibef3ce9d1167b9c4ff3d5717b113cd3ed374f5e3
This commit is contained in:
parent
bdfc13a5c0
commit
5284564071
@ -39,8 +39,8 @@ function trap_cleanup() {
|
||||
}
|
||||
|
||||
function cleanup () {
|
||||
dib-block-device umount
|
||||
unmount_image
|
||||
dib-block-device umount
|
||||
cleanup_build_dir
|
||||
cleanup_image_dir
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user