Use ordered data mode & disable delayed allocation when /config is ext4

Issues were observed on Chimera (gfch100) devices with zero-length files
in /config, believed to have occurred due to power being pulled on the
first boot after a factory reset when the system would be creating many
new files in /config since the partition would have just been recreated.

ext4's writeback data mode does not journal data at all and does not
guarantee any ordering between data and metadata writes. As the ext4
documentation states, "A crash+recovery can cause incorrect data to
appear in files which were written shortly before the crash." Ordered
data mode ensures that data blocks are written before metadata.
However, even if ordered data mode is used, ext4's delayed allocation
feature can still result in empty files after a crash since new data
blocks whose allocation is deferred can still be written after metadata.

Data integrity is more critical than performance on /config in
particular. This change shifts from writeback to ordered data mode and
also disables delayed allocation to ensure that all data blocks are
written before metadata.

Also adds an fsync to utils.sh's atomic() function for another layer of
protection against this same issue.

Change-Id: Idd1f96c6e6bf53df562a315d1c3f537b347a6fe5
3 files changed