From: Paulo Alcantara <pc@cjr.nz>
Date: Fri, 4 Jun 2021 19:25:33 -0300
Subject: [PATCH] cifs: do not share tcp servers with dfs mounts
Git-commit: f3c852b0b0fc0e4ecabbf2e8480c2a088d54b588
References: bsc#1185902
Patch-mainline: v5.14-rc1
It isn't enough to have unshared tcons because multiple DFS mounts can
connect to same target server and failover to different servers, so we
can't use a single tcp server for such cases.
For the simplest solution, use nosharesock option to achieve that.
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Paulo Alcantara <palcantara@suse.de>
---
fs/cifs/connect.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3306,10 +3306,7 @@ cifs_find_tcon(struct cifs_ses *ses, str
spin_lock(&cifs_tcp_ses_lock);
list_for_each(tmp, &ses->tcon_list) {
tcon = list_entry(tmp, struct cifs_tcon, tcon_list);
-#ifdef CONFIG_CIFS_DFS_UPCALL
- if (tcon->dfs_path)
- continue;
-#endif
+
if (!match_tcon(tcon, volume_info))
continue;
++tcon->tc_count;
@@ -4800,6 +4797,8 @@ int cifs_mount(struct cifs_sb_info *cifs
goto error;
}
+ vol->nosharesock = true;
+
/* Get path of DFS root */
ref_path = build_unc_path_to_root(vol, cifs_sb, false);
if (IS_ERR(ref_path)) {