Stefan Koehler
2025-Nov-18 09:13 UTC
[Samba] Defining OutputBufferLength for SMB2_FIND_BOTH_DIRECTORY_INFO
Hello, I have a third-party Windows application (which cannot be changed) that accesses files located on an SMB share. The problem is that the application issues searches on the SMB share, which results in several SMB2_FIND_BOTH_DIRECTORY_INFO requests. These requests generate a large number of SMB2_FIND_BOTH_DIRECTORY_INFO responses (search pattern "*" is used) until the ?Error: STATUS_NO_MORE_FILES? condition is reached. The SMB2 service response time statistics reflect the problem, as the Find procedure - with roughly 13,000 calls - dominates the total SRT by far (resulting in a lot of network round trips). I already researched the SMB protocol definitions and found this: https://winprotocoldocs-bhdugrdyduf5h2e4.b02.azurefd.net/MS-SMB2/%5bMS-SMB2%5d.pdf MaxTransactSize (4 bytes): The maximum size, in bytes, of the buffer that can be used for QUERY_INFO, QUERY_DIRECTORY, SET_INFO and CHANGE_NOTIFY operations. This field is applicable only for buffers sent by the client in SET_INFO requests, or returned from the server in QUERY_INFO, QUERY_DIRECTORY, and CHANGE_NOTIFY responses.<27> <27> Section 2.2.4: Windows clients do not enforce the MaxTransactSize value. https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/10906442-294c-46d3-8515-c277efe1f752 2.2.33 SMB2 QUERY_DIRECTORY Request OutputBufferLength (4 bytes): The maximum number of bytes the server is allowed to return in the SMB2 QUERY_DIRECTORY Response. If I check the OutputBufferLength in the SMB2_FIND_BOTH_DIRECTORY_INFO request, it shows ?Output Buffer Length: 4096?, which also matches the ?Blob Length: 4070? in the SMB2_FIND_BOTH_DIRECTORY_INFO responses. My question is: How can I increase the OutputBufferLength to 16 KB (or maybe even higher) to reduce the network round trips for the SMB2_FIND_BOTH_DIRECTORY_INFO requests? No matter if I have to set an option/parameter on server or client side. Server Debian 6.12.33 Server Samba version 4.22.5 Client Windows 10 testparm -sv | grep -i smb2 client min protocol = SMB2_02 server min protocol = SMB2_02 smb2 disable lock sequence checking = No smb2 disable oplock break retry = No smb2 leases = Yes smb2 max credits = 8192 smb2 max read = 8388608 smb2 max trans = 8388608 smb2 max write = 8388608 Thank you. Best Regards Stefan
Ralph Boehme
2025-Nov-19 08:32 UTC
[Samba] Defining OutputBufferLength for SMB2_FIND_BOTH_DIRECTORY_INFO
On 11/18/25 10:13 AM, Stefan Koehler via samba wrote:> My question is: How can I increase the OutputBufferLength to 16 KB > (or maybe even higher) to reduce the network round trips for the > SMB2_FIND_BOTH_DIRECTORY_INFO requests? No matter if I have to set > an option/parameter on server or client side.I'm not aware of any way to influence this client choice and I'm a bit surprised that Win 10 uses such a small value in your case. Iirc I've seen Win 10 and even older Windows versions use values up to the protocol max on the wire. -slow -- Join us for the 25th sambaXP 2026 conference April 20th & 21th, 2026 at Hotel Freizeit In sponsored by TranquilIT & Microsoft & SerNet Ticketing & more Info at https://sambaxp.org SerNet Samba Team Lead https://sernet.de/ Samba Team PLC https://samba.org/ Support and Development https://samba.plus/services/ SAMBA+ packages https://samba.plus/products/samba -------------- 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/samba/attachments/20251119/cc123f87/OpenPGP_signature.sig>