aboutsummaryrefslogtreecommitdiff
path: root/fs/cifs/dfs.c
diff options
context:
space:
mode:
authorGravatar Paulo Alcantara <pc@manguebit.com> 2023-04-27 04:40:08 -0300
committerGravatar Steve French <stfrench@microsoft.com> 2023-05-03 23:29:47 -0500
commit6be2ea33a4093402252724a00c4af8033725184c (patch)
tree79c111db007aed6fab0cb82837480909e17eaabb /fs/cifs/dfs.c
parentcifs: protect access of TCP_Server_Info::{origin,leaf}_fullpath (diff)
downloadlinux-6be2ea33a4093402252724a00c4af8033725184c.tar.gz
linux-6be2ea33a4093402252724a00c4af8033725184c.tar.bz2
linux-6be2ea33a4093402252724a00c4af8033725184c.zip
cifs: avoid potential races when handling multiple dfs tcons
Now that a DFS tcon manages its own list of DFS referrals and sessions, there is no point in having a single worker to refresh referrals of all DFS tcons. Make it faster and less prone to race conditions when having several mounts by queueing a worker per DFS tcon that will take care of refreshing only the DFS referrals related to it. Cc: stable@vger.kernel.org # v6.2+ Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/dfs.c')
-rw-r--r--fs/cifs/dfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/cifs/dfs.c b/fs/cifs/dfs.c
index c4ec5c67087b..da4e083b1ab4 100644
--- a/fs/cifs/dfs.c
+++ b/fs/cifs/dfs.c
@@ -157,6 +157,8 @@ static int get_dfs_conn(struct cifs_mount_ctx *mnt_ctx, const char *ref_path, co
rc = cifs_is_path_remote(mnt_ctx);
}
+ dfs_cache_noreq_update_tgthint(ref_path + 1, tit);
+
if (rc == -EREMOTE && is_refsrv) {
rc2 = get_root_smb_session(mnt_ctx);
if (rc2)
@@ -259,6 +261,8 @@ static int __dfs_mount_share(struct cifs_mount_ctx *mnt_ctx)
if (list_empty(&tcon->dfs_ses_list)) {
list_replace_init(&mnt_ctx->dfs_ses_list,
&tcon->dfs_ses_list);
+ queue_delayed_work(dfscache_wq, &tcon->dfs_cache_work,
+ dfs_cache_get_ttl() * HZ);
} else {
dfs_put_root_smb_sessions(&mnt_ctx->dfs_ses_list);
}