[Freeipa-devel] [freeipa PR#699][comment] ipaclient/ipapython macOS compatibility fixes

tiran freeipa-github-notification at redhat.com
Mon Apr 10 06:58:15 UTC 2017


  URL: https://github.com/freeipa/freeipa/pull/699
Title: #699: ipaclient/ipapython macOS compatibility fixes

tiran commented:
"""
I wrote that ```fdatasync``` -> ```fsync``` is fine. It's my code after all.

Explanation: fdatasync is a slightly optimized version of fsync that does not flush some metadata to disk, https://linux.die.net/man/2/fdatasync

> fdatasync() is similar to fsync(), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled. For example, changes to st_atime or st_mtime (respectively, time of last access and time of last modification; see stat(2)) do not require flushing because they are not necessary for a subsequent data read to be handled correctly. On the other hand, a change to the file size (st_size, as made by say ftruncate(2)), would require a metadata flush. 

When I write the code, I chose ```fdatasync``` because ```st_mtime``` isn't strictly required for the cache files. ```fdatasync``` is a micro-optimization that fails under macOS. Instead of making the code even more complicated, I have approved the platform agnostic ```fsync``` syscall. It doesn't hurt to flush all data to disk. The files are rarely written anyway.
"""

See the full comment at https://github.com/freeipa/freeipa/pull/699#issuecomment-292865333


More information about the Freeipa-devel mailing list