[cifs-protocol] [EXTERNAL] Re: MS-SMB2: write-through and unbuffered IO - TrackingID#2503140040013211

Ralph Boehme slow at samba.org
Wed Mar 19 09:14:00 UTC 2025


Hi Kristian,

ok, thanks for checking!

-slow

On 3/18/25 10:19 PM, Kristian Smith wrote:
> Hi Slow,
> 
> After some code research, I was able to first verify that Windows SMB Server does enable write-though by default for Continuously-Available (CA) shares. To your point, I was also unable to locate this information in the spec, so this should indeed be added.
> 
> I will work on updating MS-SMB2 with this info and you can expect to see the change in a forthcoming version of the document.
> 
> Thanks for helping us improve the Open Specs!
> 
> Regards,
> Kristian Smith
> Support Escalation Engineer | Microsoft(r) Corporation
> Email: kristian.smith at microsoft.com
> 
> -----Original Message-----
> From: Kristian Smith
> Sent: Friday, March 14, 2025 5:49 PM
> To: Ralph Boehme <slow at samba.org>
> Cc: cifs-protocol at lists.samba.org; Microsoft Support <supportmail at microsoft.com>
> Subject: RE: [EXTERNAL] Re: MS-SMB2: write-through and unbuffered IO - TrackingID#2502270040011252
> 
> Hi Slow,
> 
> I'll look into this and get back to you with what I find.
> 
> Also, upon further review of the previous note I sent you, it actually appears that the document is accurate in that if *both* SMB2_WRITEFLAG_WRITE_UNBUFFERED and FILE_NO_INTERMEDIATE_BUFFERING flags are not set, it will not be considered an unbuffered write. This would then throw the error " STATUS_INVALID_PARAMETER" as the per-request write through flag is only supported for unbuffered writes. Apologies for the confusion.
> 
> I will let you know what I find regarding persisting modifications to stable storage prior to completion of I/O.
> 
> Regards,
> Kristian Smith
> Support Escalation Engineer | Microsoft(r) Corporation
> Email: kristian.smith at microsoft.com
> 
> -----Original Message-----
> From: Ralph Boehme <slow at samba.org>
> Sent: Friday, March 14, 2025 5:23 AM
> To: Kristian Smith <Kristian.Smith at microsoft.com>
> Cc: cifs-protocol at lists.samba.org; Microsoft Support <supportmail at microsoft.com>
> Subject: [EXTERNAL] Re: MS-SMB2: write-through and unbuffered IO - TrackingID#2502270040011252
> 
> Hi Kristian,
> 
> thanks, makes sense.
> 
> On a related note: from SDC presentations and from memory, for SMB3 Persistent Handles the server must ensure that IO is persisted on stable storage before sending a response to the client, iow force SMB2_WRITEFLAG_WRITE_THROUGH for all IO requests on Persistent Handles.
> 
> <https://www.snia.org/educational-library/smb-22-bigger-faster-scalier-parts-1-and-2-2011>
> 
> Page 42:
> 
> "All modifications made via the handle are persisted to stable storage before the I/O is completed."
> 
> However, I fail to find any protocol documentation corresponding to this requirement. Can you please point me at the relevant section(s)?
> 
> Thanks!
> -slow
> 
> On 3/13/25 10:50 PM, Kristian Smith wrote:
>> Hi Slow,
>>
>> Thanks again for your patience while I researched this. I have confirmed that the per-request write-through flag is only supported for unbuffered writes. There is a discrepancy, however, in the wording of the doc such that the AND in the following quote:
>>
>> "If Connection.Dialect is "3.0.2" or "3.1.1", SMB2_WRITEFLAG_WRITE_THROUGH is set in the Flags field of the request, SMB2_WRITEFLAG_WRITE_UNBUFFERED is not set in the Flags field of the request, and Open.CreateOptions doesn't include the FILE_NO_INTERMEDIATE_BUFFERING bit, the server MUST fail the request with STATUS_INVALID_PARAMETER."
>>
>> Should be an OR as seen below:
>>
>> " If Connection.Dialect is "3.0.2" or "3.1.1", SMB2_WRITEFLAG_WRITE_THROUGH is set in the Flags field of the request, SMB2_WRITEFLAG_WRITE_UNBUFFERED is not set in the Flags field of the request, OR Open.CreateOptions doesn't include the FILE_NO_INTERMEDIATE_BUFFERING bit, the server MUST fail the request with STATUS_INVALID_PARAMETER."
>>
>> You should see this change in a future release of the document. Please let me know if you have any other questions or concerns.
>>
>> Regards,
>> Kristian Smith
>> Support Escalation Engineer | Microsoft(r) Corporation
>> Email: kristian.smith at microsoft.com
>>
>> -----Original Message-----
>> From: Kristian Smith
>> Sent: Tuesday, March 11, 2025 8:43 AM
>> To: Ralph Boehme <slow at samba.org>
>> Cc: cifs-protocol at lists.samba.org; Microsoft Support
>> <supportmail at microsoft.com>
>> Subject: RE: MS-SMB2: write-through and unbuffered IO -
>> TrackingID#2502270040011252
>>
>> Hi Slow,
>>
>> Apologies for the delayed response on this question. I've been researching the code on this issue and should have findings soon.
>>
>> Thank you for your patience.
>>
>> Regards,
>> Kristian Smith
>> Support Escalation Engineer | Microsoft(r) Corporation
>> Email: kristian.smith at microsoft.com
>>
>> -----Original Message-----
>> From: Obaid Farooqi <obaidf at microsoft.com>
>> Sent: Thursday, February 27, 2025 9:47 AM
>> To: Ralph Boehme <slow at samba.org>
>> Cc: cifs-protocol at lists.samba.org; Microsoft Support
>> <supportmail at microsoft.com>
>> Subject: MS-SMB2: write-through and unbuffered IO -
>> TrackingID#2502270040011252
>>
>> Hi Ralph:
>> Thanks for contacting Microsoft. I have created a case to track this issue. A member of the open specifications team will be in touch soon.
>>
>> Regards,
>> Obaid Farooqi
>> Escalation Engineer | Microsoft
>>
>> -----Original Message-----
>> From: Ralph Boehme <slow at samba.org>
>> Sent: Thursday, February 27, 2025 8:42 AM
>> To: Interoperability Documentation Help <dochelp at microsoft.com>
>> Cc: cifs-protocol at lists.samba.org
>> Subject: [EXTERNAL] MS-SMB2: write-through and unbuffered IO
>>
>> Hello dochelp,
>>
>> I'm doing some research on the expected server behaviour wrt to write-through and unbuffered IO, driven by working on the Persistent Handles implementation in Samba.
>>
>> As per MS-SMB2 the protocol offers knobs to request these
>>
>> 1) at open time, and
>> 2) per write
>>
>> For 1) there are
>>
>> FILE_WRITE_THROUGH
>> FILE_NO_INTERMEDIATE_BUFFERING
>>
>> and for 2) there are
>>
>> SMB2_WRITEFLAG_WRITE_THROUGH
>> SMB2_WRITEFLAG_WRITE_UNBUFFERED
>>
>> The protocol documentation (also when read together with MS-FSA and
>> MS-CIFS) seems to be a bit vague wrt to dependencies between per-open behaviour and per-write behaviour.
>>
>> ---8<---
>> 3.3.5.13 "Receiving an SMB2 WRITE Request"
>>
>> If Connection.Dialect is "3.0.2" or "3.1.1", SMB2_WRITEFLAG_WRITE_THROUGH is set in the Flags field of the request, SMB2_WRITEFLAG_WRITE_UNBUFFERED is not set in the Flags field of the request, and Open.CreateOptions doesn't include the FILE_NO_INTERMEDIATE_BUFFERING bit, the server MUST fail the request with STATUS_INVALID_PARAMETER.
>>
>> If Connection.Dialect is "2.1" or "3.0", SMB2_WRITEFLAG_WRITE_THROUGH is set in the Flags field of the request, and Open.CreateOptions doesn't include the FILE_NO_INTERMEDIATE_BUFFERING bit, the server MUST fail the request with STATUS_INVALID_PARAMETER.
>> ---8<---
>>
>> If my reading of the above paragraph is correct, it is not possible to to request per-write write-through IO without requesting unbuffered IO on the handle.
>>
>> Is this true? Am I missing something? Can you please clarify?
>>
>> Thanks!
>> -slow
>>
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/cifs-protocol/attachments/20250319/64d5b4b1/OpenPGP_signature.sig>


More information about the cifs-protocol mailing list