← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~raharper/cloud-init:ds-ovf-use-util-find-devs-with into cloud-init:master

 

As it turns out, two parallel instances of /bin/mount pointing to the same device will cause one to fail; it appears that there is some sort of locking/ref-counting during a mount operation that results in one of the two mount processes getting EBUSY as a result.

This sort of race is recreatable outside of cloud-init:

# rw mount loop
while true; do
    umount -f ${MNT_POINT} |:
    mount ${DISK} ${MNT_POINT} -t ext4 -o defaults || {
    	echo "`date +%s.%N`: mount failed on COUNT=$COUNT";
        exit 1
    }
    echo "`date +%s.%N`: COUNT=$COUNT" > ${MNT_POINT}/lasttouch
    COUNT=$(($COUNT + 1))
done

# ro mount loop
while true; do
    dd if=${DISK} bs=512 count=1 of=/dev/null
    # we expect this to fail, that's OK
    mount -o ro,sync -t iso9660 ${DISK} ${MNT_POINT} |:
    echo "`date +%s.%N`: READ COUNT=$COUNT"
    COUNT=$(($COUNT + 1))
done



-- 
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/330995
Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:ds-ovf-use-util-find-devs-with into cloud-init:master.


References