fsync(2) manual and hdd write caching

Bruce Cran bruce at cran.org.uk
Tue Oct 26 23:28:56 UTC 2010


On Wed, 27 Oct 2010 01:19:18 +0200
Ivan Voras <ivoras at freebsd.org> wrote:

> fsync(2) actually does behave as advertised, "auses all modified data 
> and attributes of fd to be moved to a permanent storage device". It
> is the problem of the "permanent storage device" if it caches this
> data further.

http://www.opengroup.org/onlinepubs/009695399/functions/fsync.html at
first suggests it should flush write caches, but does allow for
implementations that don't:

"The fsync() function is intended to force a physical write of data
from the buffer cache, and to assure that after a system crash or other
failure that all data up to the time of the fsync() call is recorded on
the disk."

...

"In the middle ground between these extremes, fsync() might or might
not actually cause data to be written where it is safe from a power
failure."

-- 
Bruce Cran


More information about the freebsd-hackers mailing list