• Paulo Alcantara's avatar
    smb: client: ensure to try all targets when finding nested links · ce04127c
    Paulo Alcantara authored
    With current implementation, when a nested DFS link is found during
    mount(2), the client follows the referral and then try to connect to
    all of its targets.  If all targets failed, the client bails out
    rather than retrying remaining targets from previous referral.
    
    Fix this by stacking all referrals and targets so the client can retry
    remaining targets from previous referrals in case all targets of
    current referral have failed.
    
    Thanks to samba, this can be easily tested like below
    
    * Run the following under dfs folder in samba server
    
      $ ln -s "msdfs:srv\\bad-share" link1
      $ ln -s "msdfs:srv\\dfs\\link1,srv\\good-share" link0
    
    * Before patch
    
      $ mount.cifs //srv/dfs/link0 /mnt -o ...
      mount error(2): No such file or directory
      Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)...
    
    * After patch
    
      $ mount.cifs //srv/dfs/link0 /mnt -o ...
      # ls /mnt
      bar  fileshare1  sub
    Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    ce04127c
dfs.c 14.9 KB