linux fsync behaviour
Hi all,
Two file descriptors are pointing the same file. When fsync is called on
one fd, the data written by the other fd will also be flushed? We are using linux XFS.
Thanks,
-Yuan
--
View this message in context: http://linux-kernel.2935.n7.nabble.com/linux-fsync-behaviour-tp911707.html
Sent from the Linux Kernel mailing list archive at Nabble.com.
Quoted 5 lines · yuanh
Hi all,
Two file descriptors are pointing the same file. When fsync is called on
one fd, the data written by the other fd will also be flushed? We are using linux XFS.
Yes.
-Dave.
Signature · 2 lines
Dave Chinner [email protected]
Hi,
Quoted 8 lines · Dave Chinner
Quoted 5 lines · yuanh
Hi all,
Two file descriptors are pointing the same file. When fsync is called on
one fd, the data written by the other fd will also be flushed? We are using linux XFS.Yes.
But beware of the common mistake of using fwrite + fsync which does not actually do what you intend at all and you must instead use fwrite + fflush + fsync... If you are using write(2) then just fsync is obviously fine.
Best regards,
Anton
Signature · 3 lines
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) University of Cambridge Information Services, Roger Needham Building 7 JJ Thomson Avenue, Cambridge, CB3 0RB, UK