chiark / gitweb /
"Don't fear the fsync()"
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Thu, 17 Aug 2017 16:09:44 +0000 (17:09 +0100)
committerSven Eden <yamakuzure@gmx.net>
Tue, 29 Aug 2017 14:57:55 +0000 (16:57 +0200)
commitc3b248bfd14c636db6f5c012446a2bd72c0df466
tree014cc04b94eafdf03b64833dc8248a16b3bc13cc
parent1678024cd8e9a20bf07d1bd1dda76104b5418391
"Don't fear the fsync()"

For files which are vital to boot

1. Avoid opening any window where power loss will zero them out or worse.
   I know app developers all coded to the ext3 implementation, but
   the only formal documentation we have says we're broken if we actually
   rely on it.  E.g.

   * `man mount`, search for `auto_da_alloc`.
   * http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change
   * https://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/

2. If we tell the kernel we're interested in writing them to disk, it will
   tell us if that fails.  So at minimum, this means we play our part in
   notifying the user about errors.

I refactored error-handling in `udevadm-hwdb` a little.  It turns out I did
exactly the same as had already been done in the `elogind-hwdb` version,
i.e. commit d702dcd.
src/basic/fileio.c
src/basic/fileio.h