[Samba-Technical] Wrtiing files from one linux to another linux

Urban Widmark urban at teststation.com
Wed Aug 28 04:35:40 GMT 2002


On Wed, 28 Aug 2002, Kevin Liao wrote:

> Then, no matter which one of the above two situations happens, the data is
> not yet written to the physical storage at that time, right? Should I need
> to call fsync() each time after calling write()? Thanks a lot!

Yes, at each point where you want to ensure the data is written (not
necessarily after each write).

fsync() (and also fdatasync()?) will cause the local kernel to write any
modified pages, and for smbfs it also sends a "SMBflush" that tells the
other end to sync it to disk.

For mmap()'ed data you can use msync().

Haven't tested if open(..., O_SYNC) works.

/Urban




More information about the samba-technical mailing list