diff options
author | Paulo Alcantara <pc@cjr.nz> | 2022-12-13 07:23:16 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2022-12-19 17:03:12 +0300 |
commit | 6916881f443f67f6893b504fa2171468c8aed915 (patch) | |
tree | 706aefb2bdbc045f97d071823853fc2b3240d916 /fs/cifs/connect.c | |
parent | cb3f6d8764529c33269c3478c17641cb097a615b (diff) | |
download | linux-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/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index a66cb23a954e..db3a2b3ac497 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -4150,7 +4150,8 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t int rc; struct TCP_Server_Info *server = tcon->ses->server; const struct smb_version_operations *ops = server->ops; - struct cifs_tcon *ipc = tcon->ses->tcon_ipc; + struct cifs_ses *root_ses = CIFS_DFS_ROOT_SES(tcon->ses); + struct cifs_tcon *ipc = root_ses->tcon_ipc; char *share = NULL, *prefix = NULL; const char *tcp_host; size_t tcp_host_len; @@ -4208,7 +4209,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t * reconnect so either the demultiplex thread or the echo worker will reconnect to * newly resolved target. */ - if (dfs_cache_find(xid, tcon->ses, cifs_sb->local_nls, cifs_remap(cifs_sb), target, + if (dfs_cache_find(xid, root_ses, cifs_sb->local_nls, cifs_remap(cifs_sb), target, NULL, &ntl)) { rc = ops->tree_connect(xid, tcon->ses, tree, tcon, cifs_sb->local_nls); if (rc) |