dracut: write initramfs to temp file then move into place
We've been finding cases where multiple instances of dracut can be launched simultaneously, resulting in a corrupted initramfs file. This patch makes dracut write the initramfs to a new file, then move it into place atomically.master
parent
9c65c125a9
commit
9a9c6e1256
|
@ -1103,10 +1103,11 @@ fi
|
||||||
rm -f "$outfile"
|
rm -f "$outfile"
|
||||||
dinfo "*** Creating image file ***"
|
dinfo "*** Creating image file ***"
|
||||||
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||||
$compress > "$outfile"; ); then
|
$compress > "$outfile.$$"; ); then
|
||||||
dfatal "dracut: creation of $outfile failed"
|
dfatal "dracut: creation of $outfile.$$ failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
mv $outfile.$$ $outfile
|
||||||
dinfo "*** Creating image file done ***"
|
dinfo "*** Creating image file done ***"
|
||||||
|
|
||||||
dinfo "Wrote $outfile:"
|
dinfo "Wrote $outfile:"
|
||||||
|
|
Loading…
Reference in New Issue