[haproxy] anchor; make sure configuration is flushed before rename
The pattern: create, write, close, rename is *not* robust in many circumstances. The data blocks from the write are not always flushed/persisted before the rename (metadata) changes meaning you can end up where the replacement file is corrupted (usually has 0 bytes at the end). Change-Id: Icdd2bb6f20330e5e94b3081f0d0b8a74417f60d4
This commit is contained in:
parent
bd8a62b2c3
commit
14febda1e3
|
@ -134,6 +134,8 @@ install_config() {
|
|||
echo Replacing HAProxy config file "$HAPROXY_CONF" with:
|
||||
cat "$NEXT_HAPROXY_CONF"
|
||||
echo
|
||||
# ensure data blocks are flushed before rename
|
||||
sync
|
||||
mv "$NEXT_HAPROXY_CONF" "$HAPROXY_CONF"
|
||||
else
|
||||
echo "New config failed validation, refusing to replace."
|
||||
|
|
Loading…
Reference in New Issue