Comment 13 for bug 709392

Revision history for this message
Surbhi Palande (csurbhi) wrote :

@Joseph, the semantics of O_DIRECT are different that O_SYNC.
In case of NFS, O_DIRECT *bypasses the page cache on the client* entirely. The NFS protocol does not support passing this flag to the server. By passing the client side cache could have other side effects like not being able to optimize the rpc requests. O_DIRECT on its own does not give the guarantee of writing your data to the backing store like O_SYNC.

O_SYNC on the other hand says that whatever data is requested for a write is synced to the backing store before the write operation returns. Its a synchronous write rather than an asynchronous one.

A user may want to use O_SYNC but not O_DIRECT. Coupling the two together would give you the O_SYNC effect of putting data on the disk, but would have an unwanted effect on the client side cache and could most probably degrade performance.