summaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@cjr.nz>2021-07-12 12:38:24 -0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-20 16:05:35 +0200
commit72797ffca1bdc5a21eb829c690623bf5e1199bc4 (patch)
treedd4aaa076a40bc451b1717ed3f3acfcde0cce758 /fs/cifs
parentb93f9499427cf15ee39877c43052ed26527e59ff (diff)
downloadlinux-stable-72797ffca1bdc5a21eb829c690623bf5e1199bc4.tar.gz
linux-stable-72797ffca1bdc5a21eb829c690623bf5e1199bc4.tar.bz2
linux-stable-72797ffca1bdc5a21eb829c690623bf5e1199bc4.zip
cifs: handle reconnect of tcon when there is no cached dfs referral
commit 507345b5ae6a57b7ecd7550ff39282ed20de7b8d upstream. When there is no cached DFS referral of tcon->dfs_path, then reconnect to same share. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Cc: <stable@vger.kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index fb7088d57e46..8ffe8063e42c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -5352,7 +5352,8 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
if (!tree)
return -ENOMEM;
- if (!tcon->dfs_path) {
+ /* If it is not dfs or there was no cached dfs referral, then reconnect to same share */
+ if (!tcon->dfs_path || dfs_cache_noreq_find(tcon->dfs_path + 1, &ref, &tl)) {
if (tcon->ipc) {
scnprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$", server->hostname);
rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc);
@@ -5362,9 +5363,6 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
goto out;
}
- rc = dfs_cache_noreq_find(tcon->dfs_path + 1, &ref, &tl);
- if (rc)
- goto out;
isroot = ref.server_type == DFS_TYPE_ROOT;
free_dfs_info_param(&ref);