Bug 13651 - File No Intermediate Buffering flag in the SMB CREATE request (in create options) not integrated.
Summary: File No Intermediate Buffering flag in the SMB CREATE request (in create opti...
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All All
: P5 minor (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL: https://github.com/samba-team/samba/b...
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-09 12:01 UTC by Sander Spetebroot
Modified: 2018-10-09 13:09 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sander Spetebroot 2018-10-09 12:01:55 UTC
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
Comment 1 Sander Spetebroot 2018-10-09 12:04:07 UTC
I will propose an initial patch this week.
Comment 2 Ralph Böhme 2018-10-09 12:47:10 UTC
Correct, Samba does not implement this yet. But I guess FILE_NO_INTERMEDIATE_BUFFERING resembles O_DIRECT, not O_SYNC
Comment 3 Sander Spetebroot 2018-10-09 13:00:01 UTC
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.
Comment 4 Ralph Böhme 2018-10-09 13:09:33 UTC
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().