summaryrefslogtreecommitdiff
path: root/fs/cifs/dfs.c
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@cjr.nz>2022-12-13 07:23:16 +0300
committerSteve French <stfrench@microsoft.com>2022-12-19 17:03:12 +0300
commit6916881f443f67f6893b504fa2171468c8aed915 (patch)
tree706aefb2bdbc045f97d071823853fc2b3240d916 /fs/cifs/dfs.c
parentcb3f6d8764529c33269c3478c17641cb097a615b (diff)
downloadlinux-6916881f443f67f6893b504fa2171468c8aed915.tar.xz
cifs: fix refresh of cached referrals
We can't rely on cifs_tcon::ses to refresh cached referral as the server target might not respond to referrals, e.g. share is not hosted in a DFS root server. Consider the following mount //dom/dfs/link -> /root1/dfs/link -> /fs0/share where fs0 can't get a referral for "/root1/dfs/link". To simplify and fix the access of dfs root sessions, store the dfs root session pointer directly to new sessions so making it easier to select the appropriate ipc connection and use it for failover or cache refresh. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/dfs.c')
-rw-r--r--fs/cifs/dfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/cifs/dfs.c b/fs/cifs/dfs.c
index 88a0cab335b4..fbc8e880a1fe 100644
--- a/fs/cifs/dfs.c
+++ b/fs/cifs/dfs.c
@@ -95,7 +95,13 @@ static int get_session(struct cifs_mount_ctx *mnt_ctx, const char *full_path)
ctx->leaf_fullpath = (char *)full_path;
rc = cifs_mount_get_session(mnt_ctx);
ctx->leaf_fullpath = NULL;
+ if (!rc) {
+ struct cifs_ses *ses = mnt_ctx->ses;
+ mutex_lock(&ses->session_mutex);
+ ses->dfs_root_ses = mnt_ctx->root_ses;
+ mutex_unlock(&ses->session_mutex);
+ }
return rc;
}