Skip Menu |

From: Ken Raeburn <raeburn@MIT.EDU>
To: krb5-bugs@MIT.EDU
Subject: use of fsync
Date: Wed, 11 Mar 2009 20:35:17 -0400
Seeing some stuff Ted's written up at
reminds me... we've got various places where we write out new
versions of files and rename them into place, but we don't call fsync
or fsyncdata in all of them to ensure that the new file is safely on
disk before we kill the old one. It would be a shame if a system
crash while using "kdb5_ldap_util stashsrvpw" to add a new password
entry caused the old password entries to get lost.

We should check other cases... calls to rename(), or open() with
O_TRUNC (to rewrite a file in place, which may also be risky depending
on the file) would be a good place to start. We don't have a lot of
them, and a bunch are within the db2 code, which is probably already
doing the fsync reasonably.