• Shyam Prasad N's avatar
    cifs: maintain a state machine for tcp/smb/tcon sessions · 73f9bfbe
    Shyam Prasad N authored
    If functions like cifs_negotiate_protocol, cifs_setup_session,
    cifs_tree_connect are called in parallel on different channels,
    each of these will be execute the requests. This maybe unnecessary
    in some cases, and only the first caller may need to do the work.
    
    This is achieved by having more states for the tcp/smb/tcon session
    status fields. And tracking the state of reconnection based on the
    state machine.
    
    For example:
    for tcp connections:
    CifsNew/CifsNeedReconnect ->
      CifsNeedNegotiate ->
        CifsInNegotiate ->
          CifsNeedSessSetup ->
            CifsInSessSetup ->
              CifsGood
    
    for smb sessions:
    CifsNew/CifsNeedReconnect ->
      CifsGood
    
    for tcon:
    CifsNew/CifsNeedReconnect ->
      CifsInFilesInvalidate ->
        CifsNeedTcon ->
          CifsInTcon ->
            CifsGood
    
    If any channel reconnect sees that it's in the middle of
    transition to CifsGood, then they can skip the function.
    Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    73f9bfbe
sess.c 43.4 KB