Skip to content

Commit 65303de

Browse files
Paulo Alcantarasmfrench
authored andcommitted
cifs: do not share tcons with DFS
This disables tcon re-use for DFS shares. tcon->dfs_path stores the path that the tcon should connect to when doing failing over. If that tcon is used multiple times e.g. 2 mounts using it with different prefixpath, each will need a different dfs_path but there is only one tcon. The other solution would be to split the tcon in 2 tcons during failover but that is much harder. tcons could not be shared with DFS in cifs.ko because in a DFS namespace like: //domain/dfsroot -> /serverA/dfsroot, /serverB/dfsroot //serverA/dfsroot/link -> /serverA/target1/aa/bb //serverA/dfsroot/link2 -> /serverA/target1/cc/dd you can see that link and link2 are two DFS links that both resolve to the same target share (/serverA/target1), so cifs.ko will only contain a single tcon for both link and link2. The problem with that is, if we (auto)mount "link" and "link2", cifs.ko will only contain a single tcon for both DFS links so we couldn't perform failover or refresh the DFS cache for both links because tcon->dfs_path was set to either "link" or "link2", but not both -- which is wrong. Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent d92c7ce commit 65303de

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/cifs/connect.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3375,6 +3375,10 @@ cifs_find_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
33753375
spin_lock(&cifs_tcp_ses_lock);
33763376
list_for_each(tmp, &ses->tcon_list) {
33773377
tcon = list_entry(tmp, struct cifs_tcon, tcon_list);
3378+
#ifdef CONFIG_CIFS_DFS_UPCALL
3379+
if (tcon->dfs_path)
3380+
continue;
3381+
#endif
33783382
if (!match_tcon(tcon, volume_info))
33793383
continue;
33803384
++tcon->tc_count;

0 commit comments

Comments
 (0)