From Ira. The client will run itself out of credits, and make mistakes issuing compound requests. This code stops the client from starving itself. Microsoft likely does something similar, they document a "minimum credits" option, defaulted to 64. ------------------------------------------------------ Ira. Can you upload a packet capture showing this issue ? That would help. Personally I don't see a problem with this change, but having evidence would really help. Thanks ! Jeremy.
Created attachment 8617 [details] git-am fix for 3.6.x.
Comment on attachment 8617 [details] git-am fix for 3.6.x. I need more information on this at least a capture file. From the documentation: <149> Section 3.3.1.2: Windows Vista SP1, Windows Server 2008, Windows 7, Windows Server 2008 R2, Windows 8, and Windows Server 2012 SMB2 servers support a configurable minimum credit limit below which the client is unconditionally granted all credits it requests, and a configurable maximum credit limit above which credits are never granted, as follows: Windows Vista SP1, Windows 7, and Windows 8 => min default 128 max default 2048 Windows Server 2008,Windows Server 2008 R2, and Windows Server 2012 => min default 512 max default 8192 But that applies only for credits the client asked for. We really need to understand the problem in order to create a useful fix.
That patch has a typo. It isn't something I'd commit to Samba. (It is something I'd use in local testing.) I'll see what I can do about getting a reproduction to everyone. And also a patch against master/4.0 and 3.6.
Yep, thanks Metze. I was about to ping Ira asking for the wireshark trace (but I know he's busy :-). The patch was a placeholder so we don't lose the original fix. Jeremy.
Created attachment 8984 [details] replicator for the issue. This is a replication program for the bug this issue is about. tFindPerl.exe d:\directory\here 32 0 768 This will cause MS Win7 clients to run out of credits and into issues without a lower bound. Thanks, -Ira
Any news on this one?
Is this a showstopper for 4.2.0?
No 4.2.0 blocker, remember for 4.3
Created attachment 10677 [details] Test patch for master
I found a likely to be important difference in our credit algorithm. Windows seems to always grant the credits consumed for the current request, even if the credits requests field is 0. So the effective credits requests is always at least 1.
Created attachment 10680 [details] possible reproducer patches for smbclient -mSMB2_02 -c 'get largefile.dat /dev/null' Someone could try smbclient (with these hacks) to reproduce the problem...
(In reply to Stefan (metze) Metzmacher from comment #10) Besides that, were we possibly violating 3.3.1.2 "The server MUST ensure that the number of credits held by the client is never reduced to zero. If the condition occurs, there is no way for the client to send subsequent requests for more credits." <https://msdn.microsoft.com/en-us/library/cc246704.aspx>
(In reply to Stefan (metze) Metzmacher from comment #11) I've run with these hacks (both #1 and #2 separately) against Win2k12, and I do see 1 credit being returned for the zero-credit asks in wireshark. Running these hacks against unpatched master returns 0 for the zero-credit asks, and matches Win2k12 in returning 1 credit for the zero-credit asks when the 'Test patch for master' is applied. I guess what I'm asking is can I push the master patch ? :-). Jeremy.
(In reply to Jeremy Allison from comment #13) Are you able to get smbclient to hang? Does smbclient reach the point where it always ask for 0 credits when comsuming the last credit? Can you upload the smbclient output of the 3 runs (against windows, unpatches samba and patches samba)? (compressed with bz2) Then I can have a look at the output and see if it's as I expect. I'll add a useful commit message then and push to master with out review on it. Thanks!
(In reply to Ralph Böhme from comment #12) - } else if (xconn->smb2.credits.granted == 0) { - /* - * Make sure the client has always at least one credit - */ - credits_granted = 1; Made sure that the client has at least 1 credit, but it seems that Windows needs more than 1 credit, [MS-SMB2] says most Windows versions require at least 4 credits. I guess in order to send oplock break acks. Or do compound directory listings.
Metze wrote: > Are you able to get smbclient to hang? No, I never got smbclient to hang. But analysing the wireshark traces clearly show Win2k12 returning 1 credit with a request of zero, whereas currently smbd returns zero in the same situation. With your master patch we behave identically to Win2k12 in the same situations.
Created attachment 10691 [details] Patches for master
Created attachment 10692 [details] reproducer patches for smbclient -mSMB2_02 or -mSMB3_00
Created attachment 10693 [details] Patches for v4-2-test
Created attachment 10694 [details] Patches for v4-1-test
Created attachment 10695 [details] Patches for v4-0-test
Created attachment 10697 [details] Patches for v4-1-test
Created attachment 10698 [details] Patches for v4-0-test
Comment on attachment 10693 [details] Patches for v4-2-test LGTM.
Re-assigning to Karolin for inclusion in 4.2.0, 4.1.next, 4.0.next. Jeremy.
Pushed to autobuild-v4-2-test
Pushed to autobuild-v4-[0|1]-test.
Pushed to v4-2-test and v4-1-test. autobuild-v4-0-test is still running...
(In reply to Stefan (metze) Metzmacher from comment #28) Pushed to autobuild-v4-0-test again.
Pushed to v4-0-test. Closing out bug report. Thanks!
I have a question to this bug... I just installed samba 4.2.0 and I wanted to copy a lot of files from server to client (windows 7 64bit) and after few seconds my client freezes, it does nothing for about one minute and after that copy error is reported and everything is working again. Last messages I see in log on server are for example: [2015/03/10 11:26:40.560841, 10, pid=18123, effective(32697, 10513), real(32697, 0)] ../source3/smbd/smb2_server.c:898(smb2_set_operation_credit) smb2_set_operation_credit: requested 2, charge 1, granted 1, current possible/max 1/512, total granted/max/low/range 512/8192/36313/512 or: [2015/03/10 12:20:09.291088, 10, pid=18563, effective(32697, 10513), real(32697, 0)] ../source3/smbd/smb2_server.c:898(smb2_set_operation_credit) smb2_set_operation_credit: requested 1, charge 1, granted 1, current possible/max 2/512, total granted/max/low/range 511/8192/93417/511 is this problem related to this bug report and made changes?
(In reply to bulin.peter from comment #31) Can you create a new bug report and upload a log file with at least the last 600 requests?