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.
Created attachment 17788 [details] Another example - two samba sessions with the same request sequence.
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`.
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.
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.
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.
(In reply to Volker Lendecke from comment #5) Got it! Thank you!