fix VM autostart race condition

https://github.com/QubesOS/qubes-issues/issues/1075
This commit is contained in:
Patrick Schleizer 2015-07-30 17:46:24 +02:00
parent 39379364c7
commit 472ed54e4c

View File

@ -27,8 +27,11 @@ sfdisk --no-reread -u M "$FILENAME" > /dev/null 2> /dev/null <<EOF
,${ROOT_SIZE},L ,${ROOT_SIZE},L
EOF EOF
loopdev=`losetup -f --show --partscan "$FILENAME"` (
udevadm settle flock 200
mkswap -f ${loopdev}p1 > /dev/null loopdev=`losetup -f --show --partscan "$FILENAME"`
losetup -d ${loopdev} || : udevadm settle
chown --reference `dirname "$FILENAME"` "$FILENAME" mkswap -f ${loopdev}p1 > /dev/null
losetup -d ${loopdev} || :
chown --reference `dirname "$FILENAME"` "$FILENAME"
) 200>"/var/run/qubes/prepare-volatile-img.lock"