• Paulo Alcantara's avatar
    cifs: skip trailing separators of prefix paths · ef605e86
    Paulo Alcantara authored
    During DFS failover, prefix paths may change, so make sure to not
    leave trailing separators when parsing thew in
    dfs_cache_get_tgt_share().  The separators of prefix paths are already
    handled by build_path_from_dentry_optional_prefix().
    
    Consider the following DFS link:
    
      //dom/dfs/link: [\srv1\share\dir1, \srv2\share\dir1]
    
    Before commit:
    
      mount.cifs //dom/dfs/link
      tree connect to \\srv1\share; prefix_path=dir1
      disconnect srv1; failover to srv2
      tree connect to \\srv2\share; prefix_path=dir1\
      mv foo bar
    
      ...
      SMB2 430 Create Request File: dir1\\foo;GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO;Close Request
      SMB2 582 Create Response File: dir1\\foo;GetInfo Response;Close Response
      SMB2 430 Create Request File: dir1\\bar;GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO;Close Request
      SMB2 286 Create Response, Error: STATUS_OBJECT_NAME_NOT_FOUND;GetInfo Response, Error: STATUS_OBJECT_NAME_NOT_FOUND;Close Response, Error: STATUS_OBJECT_NAME_NOT_FOUND
      SMB2 462 Create Request File: dir1\\foo;SetInfo Request FILE_INFO/SMB2_FILE_RENAME_INFO NewName:dir1\\bar;Close Request
      SMB2 478 Create Response File: dir1\\foo;SetInfo Response, Error: STATUS_OBJECT_NAME_INVALID;Close Response
    
    After commit:
    
      mount.cifs //dom/dfs/link
      tree connect to \\srv1\share; prefix_path=dir1
      disconnect srv1; failover to srv2
      tree connect to \\srv2\share; prefix_path=dir1
      mv foo bar
    
      ...
      SMB2 430 Create Request File: dir1\foo;GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO;Close Request
      SMB2 582 Create Response File: dir1\foo;GetInfo Response;Close Response
      SMB2 430 Create Request File: dir1\bar;GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO;Close Request
      SMB2 286 Create Response, Error: STATUS_OBJECT_NAME_NOT_FOUND;GetInfo Response, Error: STATUS_OBJECT_NAME_NOT_FOUND;Close Response, Error: STATUS_OBJECT_NAME_NOT_FOUND
      SMB2 462 Create Request File: dir1\foo;SetInfo Request FILE_INFO/SMB2_FILE_RENAME_INFO NewName:dir1\bar;Close Request
      SMB2 478 Create Response File: dir1\foo;SetInfo Response;Close Response
    Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    ef605e86
dfs_cache.c 39.6 KB