• Paulo Alcantara's avatar
    cifs: fix sharing of DFS connections · 8e355415
    Paulo Alcantara authored
    When matching DFS connections, we can't rely on the values set in
    cifs_sb_info::prepath and cifs_tcon::tree_name as they might change
    during DFS failover.  The DFS referrals related to a specific DFS tcon
    are already matched earlier in match_server(), therefore we can safely
    skip those checks altogether as the connection is guaranteed to be
    unique for the DFS tcon.
    
    Besides, when creating or finding an SMB session, make sure to also
    refcount any DFS root session related to it (cifs_ses::dfs_root_ses),
    so if a new DFS mount ends up reusing the connection from the old
    mount while there was an umount(2) still in progress (e.g. umount(2)
    -> cifs_umount() -> reconnect -> cifs_put_tcon()), the connection
    could potentially be put right after the umount(2) finished.
    
    Patch has minor update to include fix for unused variable issue
    noted by the kernel test robot
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Link: https://lore.kernel.org/oe-kbuild-all/202305041040.j7W2xQSy-lkp@intel.com/
    Cc: stable@vger.kernel.org # v6.2+
    Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    8e355415
cifsproto.h 30.8 KB