• Jeff Layton's avatar
    cifs: stop trying to use virtual circuits · 9ae6cf60
    Jeff Layton authored
    Currently, we try to ensure that we use vcnum of 0 on the first
    established session on a connection and then try to use a different
    vcnum on each session after that.
    
    This is a little odd, since there's no real reason to use a different
    vcnum for each SMB session. I can only assume there was some confusion
    between SMB sessions and VCs. That's somewhat understandable since they
    both get created during SESSION_SETUP, but the documentation indicates
    that they are really orthogonal. The comment on max_vcs in particular
    looks quite misguided. An SMB session is already uniquely identified
    by the SMB UID value -- there's no need to again uniquely ID with a
    VC.
    
    Furthermore, a vcnum of 0 is a cue to the server that it should release
    any resources that were previously held by the client. This sounds like
    a good thing, until you consider that:
    
    a) it totally ignores the fact that other programs on the box (e.g.
    smbclient) might have connections established to the server. Using a
    vcnum of 0 causes them to get kicked off.
    
    b) it causes problems with NAT. If several clients are connected to the
    same server via the same NAT'ed address, whenever one connects to the
    server it kicks off all the others, which then reconnect and kick off
    the first one...ad nauseum.
    
    I don't see any reason to ignore the advice in "Implementing CIFS" which
    has a comprehensive treatment of virtual circuits. In there, it states
    "...and contrary to the specs the client should always use a VcNumber of
    one, never zero."
    
    Have the client just use a hardcoded vcnum of 1, and stop abusing the
    special behavior of vcnum 0.
    Reported-by: default avatarSauron99@gmx.de <sauron99@gmx.de>
    Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
    Reviewed-by: default avatarVolker Lendecke <vl@samba.org>
    Signed-off-by: default avatarSteve French <smfrench@gmail.com>
    9ae6cf60
cifssmb.c 188 KB