It's apparent that some thought went into making sure the config
file makes it atomically to the fs. However, one thing is missing
which is doing a fsync on the containing directory of the config file.
See: https://lwn.net/Articles/457667/
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
os.rename(savefile + ".temp", savefile)
+ # Sync the containing directory too
+ dir_fd = None
+ try:
+ dir_fd = os.open(savefile_dir, os.O_RDONLY)
+ os.fsync(dir_fd)
+ finally:
+ if dir_fd:
+ os.close(dir_fd)
+
def clear_existing(self):
'''
Remove entire current configuration.