summaryrefslogtreecommitdiff
path: root/fs/cifs/dfs.h
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@cjr.nz>2022-12-18 20:37:32 +0300
committerSteve French <stfrench@microsoft.com>2022-12-19 17:03:12 +0300
commit7ad54b98fc1f141cfb70cfe2a3d6def5a85169ff (patch)
tree6eb49be25d7938696cb4796d5a46c9a56ca6fc56 /fs/cifs/dfs.h
parent25cf01b7c9200d6ace5a59125d8166435dd9dea7 (diff)
downloadlinux-7ad54b98fc1f141cfb70cfe2a3d6def5a85169ff.tar.xz
cifs: use origin fullpath for automounts
Use TCP_Server_Info::origin_fullpath instead of cifs_tcon::tree_name when building source paths for automounts as it will be useful for domain-based DFS referrals where the connections and referrals would get either re-used from the cache or re-created when chasing the dfs link. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/dfs.h')
-rw-r--r--fs/cifs/dfs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/cifs/dfs.h b/fs/cifs/dfs.h
index bbe2ec25b0c2..344bea6d8bab 100644
--- a/fs/cifs/dfs.h
+++ b/fs/cifs/dfs.h
@@ -28,4 +28,19 @@ static inline int dfs_get_referral(struct cifs_mount_ctx *mnt_ctx, const char *p
cifs_remap(cifs_sb), path, ref, tl);
}
+static inline char *dfs_get_automount_devname(struct dentry *dentry, void *page)
+{
+ struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb);
+ struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
+ struct TCP_Server_Info *server = tcon->ses->server;
+
+ if (unlikely(!server->origin_fullpath))
+ return ERR_PTR(-EREMOTE);
+
+ return __build_path_from_dentry_optional_prefix(dentry, page,
+ server->origin_fullpath,
+ strlen(server->origin_fullpath),
+ true);
+}
+
#endif /* _CIFS_DFS_H */