The branch, v3-6-test has been updated via 3e85456 Second part of bugfix for bug #8335 - file copy aborts with smb2_validate_message_id: bad message_id via 9d579ed First part of bugfix for bug #8335 - file copy aborts with smb2_validate_message_id: bad message_id from 254cc7a s3:loadparm: fix the reload of the configuration: also reload activated registry shares
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 3e854564315a7bdc5d9837526a813b2b858e0563 Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 29 11:17:03 2011 -0700 Second part of bugfix for bug #8335 - file copy aborts with smb2_validate_message_id: bad message_id Modify the credit granting algorithm to closer to what I believe Windows does. Split up max_credits into 1/16ths, and then scale the requested credits by how many 16ths have been currently granted. Less than 1/16th == grant all requested (100%), scale down as more have been granted. Never ask for less than 1 if the client asked for at least 1. commit 9d579ed2398d7f88c9c02076e612eed877d1ec88 Author: Jeremy Allison <j...@samba.org> Date: Fri Jul 29 11:16:51 2011 -0700 First part of bugfix for bug #8335 - file copy aborts with smb2_validate_message_id: bad message_id Set default max credits to 8192 now this has been documented in the SMB2 spec. ----------------------------------------------------------------------- Summary of changes: docs-xml/smbdotconf/protocol/smb2maxcredits.xml | 2 +- source3/include/local.h | 2 +- source3/smbd/smb2_server.c | 27 ++++++++++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/docs-xml/smbdotconf/protocol/smb2maxcredits.xml b/docs-xml/smbdotconf/protocol/smb2maxcredits.xml index 69d04f7..310b898 100644 --- a/docs-xml/smbdotconf/protocol/smb2maxcredits.xml +++ b/docs-xml/smbdotconf/protocol/smb2maxcredits.xml @@ -8,7 +8,7 @@ that Samba tells the client it will allow. This is similar to the <smbconfoption name="max mux"/> parameter for SMB1. You should never need to set this parameter. </para> -<para>The default is 128 credits, which is the same as a Windows SMB2 server.</para> +<para>The default is 8192 credits, which is the same as a Windows 2008R2 SMB2 server.</para> </description> <value type="default">128</value> diff --git a/source3/include/local.h b/source3/include/local.h index 680631c..807d3c9 100644 --- a/source3/include/local.h +++ b/source3/include/local.h @@ -264,7 +264,7 @@ #define DEFAULT_SMB2_MAX_READ (1024*1024) #define DEFAULT_SMB2_MAX_WRITE (1024*1024) #define DEFAULT_SMB2_MAX_TRANSACT (1024*1024) -#define DEFAULT_SMB2_MAX_CREDITS 128 +#define DEFAULT_SMB2_MAX_CREDITS 8192 #define DEFAULT_SMB2_MAX_CREDIT_BITMAP_FACTOR 2 #endif diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index c5c7a8e..b77c636 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -452,9 +452,30 @@ static void smb2_set_operation_credit(struct smbd_server_connection *sconn, SMB_ASSERT(sconn->smb2.max_credits >= sconn->smb2.credits_granted); - /* Remember what we gave out. */ - credits_granted = MIN(credits_requested, (sconn->smb2.max_credits - - sconn->smb2.credits_granted)); + if (credits_requested) { + uint16_t modified_credits_requested; + uint32_t multiplier; + + /* + * Split up max_credits into 1/16ths, and then scale + * the requested credits by how many 16ths have been + * currently granted. Less than 1/16th == grant all + * requested (100%), scale down as more have been + * granted. Never ask for less than 1 as the client + * asked for at least 1. JRA. + */ + + multiplier = 16 - (((sconn->smb2.credits_granted * 16) / sconn->smb2.max_credits) % 16); + + modified_credits_requested = (multiplier * credits_requested) / 16; + if (modified_credits_requested == 0) { + modified_credits_requested = 1; + } + + /* Remember what we gave out. */ + credits_granted = MIN(modified_credits_requested, + (sconn->smb2.max_credits - sconn->smb2.credits_granted)); + } if (credits_granted == 0 && sconn->smb2.credits_granted == 0) { /* First negprot packet, or ensure the client credits can -- Samba Shared Repository