[krbdev.mit.edu #6409] use of fsync

Ken Raeburn via RT rt-comment at krbdev.mit.edu
Wed Mar 11 20:35:21 EDT 2009


Seeing some stuff Ted's written up at https://bugs.edge.launchpad.net/ubuntu/+source/linux/+bug/317781 
  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.

Ken




More information about the krb5-bugs mailing list