[Merge] ~gjolly/livecd-rootfs:ubuntu-cpc/device_busy into livecd-rootfs:ubuntu/master

Thomas Bechtold mp+448708 at code.launchpad.net
Wed Aug 9 04:20:32 UTC 2023



Diff comments:

> diff --git a/live-build/functions b/live-build/functions
> index 8088cb2..a51ba15 100644
> --- a/live-build/functions
> +++ b/live-build/functions
> @@ -224,20 +224,32 @@ EOF
>  
>  }
>  
> +wait_on_device_busy() {
> +    device="$1"
> +
> +    while true; do

> What's the point? there is already a timeout on the builds

The point is that we don't wait 4 hours (that's our timeout, isn't it?) blocking resources for nothing.

You could do the timeout directly in python to make the implementation easier

> +        python3 -c "import os; os.open('$device', os.O_RDONLY | os.O_EXCL)" &> /dev/null && break
> +        echo "device busy"
> +        sleep 5
> +    done
> +}
> +
>  umount_partition() {
>      local mountpoint=${1}
>      teardown_mountpoint $mountpoint
>      mount --make-private $mountpoint
>      umount $mountpoint
>      udevadm settle
> -    # workaround for LP: 1960537
> -    sleep 30 
>  
>      if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then
>          # buildd's don't have /etc/mtab symlinked
>          # /etc/mtab is needed in order zerofree space for ext4 filesystems
>          [ -e /etc/mtab ] || ln -s /proc/mounts /etc/mtab
>  
> +        # the calls to e2fsck will fail if the block device is still "busy"
> +        # this is a workaround for LP#2030771
> +        wait_on_device_busy "${rootfs_dev_mapper}"
> +
>          # both of these are likely overkill, but it does result in slightly
>          # smaller ext4 filesystem
>          e2fsck -y -E discard ${rootfs_dev_mapper}


-- 
https://code.launchpad.net/~gjolly/livecd-rootfs/+git/livecd-rootfs/+merge/448708
Your team Ubuntu Core Development Team is requested to review the proposed merge of ~gjolly/livecd-rootfs:ubuntu-cpc/device_busy into livecd-rootfs:ubuntu/master.




More information about the Ubuntu-reviews mailing list