Bug 15322 - Samba server's responses to the same request sequence are inconsistent
Summary: Samba server's responses to the same request sequence are inconsistent
Status: RESOLVED INVALID
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.18.0rc4
Hardware: All All
: P5 major (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-02 12:26 UTC by fouzhe
Modified: 2023-03-02 13:54 UTC (History)
0 users

See Also:


Attachments
Two samba sessions with the same request sequence. (21.43 KB, application/vnd.tcpdump.pcap)
2023-03-02 12:26 UTC, fouzhe
no flags Details
Another example - two samba sessions with the same request sequence. (21.43 KB, application/vnd.tcpdump.pcap)
2023-03-02 12:28 UTC, fouzhe
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description fouzhe 2023-03-02 12:26:44 UTC
Created attachment 17787 [details]
Two samba sessions with the same request sequence.

I sent the identical two request sequences to samba but got different responses. Sometimes the server responds `STATUS_PENDING` error. The attached pcap shows the two sessions. The first 66 packets belong to the first session and the remaining belong to the second.
Comment 1 fouzhe 2023-03-02 12:28:36 UTC
Created attachment 17788 [details]
Another example - two samba sessions with the same request sequence.
Comment 2 fouzhe 2023-03-02 12:33:33 UTC
In both two pcaps, the last server responses of their two sessions are different. One is normal `Read Response` while the other is `Read Response, Error: STATUS_PENDING`.
Comment 3 Volker Lendecke 2023-03-02 12:44:33 UTC
This is a legitimate reponse according to

https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/c1692ece-7c6d-45c8-a0e3-6b53c0483030

where a SMB2_READ request is handled asynchronously. smbd will eventually come back with the real response.

If you have a client implementation that can't deal with this, set

aio read size = 0
aio write size = 0

which means that read/write requests never go async.
Comment 4 fouzhe 2023-03-02 13:07:24 UTC
Thanks for your reply. When I used the samba server, it is guaranteed that there is only one link at any moment. Is it also normal that the SMB2_READ request is handled asynchronously in this situation? Thanks.
Comment 5 Volker Lendecke 2023-03-02 13:52:13 UTC
That fully depends on the "aio read size" parameter. Leaving it at the default of 1 means that reads are handled asynchronously and the PENDING packet is sent when the file system takes longer than 0.5 milliseconds to read the buffer. Once the data is there, the "normal" reply packet will follow.

As you have a client system that can not deal with the PENDING intermediate packet, please set "aio read size = 0". So please set this value in your smb.conf and you will have a deterministic direct READ response.
Comment 6 fouzhe 2023-03-02 13:54:20 UTC
(In reply to Volker Lendecke from comment #5)
Got it! Thank you!