]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/hwdb/hwdb.c
"Don't fear the fsync()"
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Thu, 17 Aug 2017 16:09:44 +0000 (17:09 +0100)
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>
Thu, 17 Aug 2017 19:26:36 +0000 (20:26 +0100)
commit0675e94ab53237ad27bfba929c7490bdd2215cf1
treeffcd2233a70ae8464b000c1b5e8d52304fa160b6
parentdce892acef1c5316fb98f7f5ea287bc74f935ca3
"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 `systemd-hwdb` version,
i.e. commit d702dcd.
src/basic/fileio.c
src/basic/fileio.h
src/boot/bootctl.c
src/firstboot/firstboot.c
src/hwdb/hwdb.c
src/locale/keymap-util.c
src/sysusers/sysusers.c
src/udev/udevadm-hwdb.c