Hello I found out that the File No Intermediate Buffering flag (FILE_NO_INTERMEDIATE_BUFFERING, https://msdn.microsoft.com/en-us/library/cc246502.aspx) in the Create Options of CREATE request is never checked/used in the Samba code. A basic solution would be to integrate it as equal to FILE_WRITE_THROUGH flag(see https://support.microsoft.com/en-us/help/99794/info-file-flag-write-through-and-file-flag-no-buffering). This would result to adding 0_SYNC to 'flags2' in 'open_file_ntcreate' (file samba/source3/smbd/open.c). A possible following step would be to disable the write caching in Samba to be even more compliant with the FILE_NO_INTERMEDIATE_BUFFERING. Kind regards Sander Spetebroot
I will propose an initial patch this week.
Correct, Samba does not implement this yet. But I guess FILE_NO_INTERMEDIATE_BUFFERING resembles O_DIRECT, not O_SYNC
Correct, I guess that is a more appropriate flag. I was confused by this link (https://support.microsoft.com/en-us/help/99794/info-file-flag-write-through-and-file-flag-no-buffering) that tells to bring the concept one step further. I will propose a patch with that flag instead.
Note that using O_DIRECT may impose alignment restrictions on the lenght and address of read and write buffers, cf man 2 open. So this may turn out to be a bigger job then just passing O_DIRECT to open().