• Ross Lagerwall's avatar
    cifs: Limit the overall credit acquired · c0432fc7
    Ross Lagerwall authored
    BugLink: http://bugs.launchpad.net/bugs/1637510
    
    commit 7d414f39 upstream.
    
    The kernel client requests 2 credits for many operations even though
    they only use 1 credit (presumably to build up a buffer of credit).
    Some servers seem to give the client as much credit as is requested.  In
    this case, the amount of credit the client has continues increasing to
    the point where (server->credits * MAX_BUFFER_SIZE) overflows in
    smb2_wait_mtu_credits().
    
    Fix this by throttling the credit requests if an set limit is reached.
    For async requests where the credit charge may be > 1, request as much
    credit as what is charged.
    The limit is chosen somewhat arbitrarily. The Windows client
    defaults to 128 credits, the Windows server allows clients up to
    512 credits (or 8192 for Windows 2016), and the NetApp server
    (and at least one other) does not limit clients at all.
    Choose a high enough value such that the client shouldn't limit
    performance.
    
    This behavior was seen with a NetApp filer (NetApp Release 9.0RC2).
    Signed-off-by: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: default avatarSteve French <smfrench@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
    c0432fc7
smb2pdu.c 81.7 KB