summaryrefslogtreecommitdiff
path: root/fs/cifs/fs_context.c
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@cjr.nz>2021-07-16 03:26:41 -0300
committerSteve French <stfrench@microsoft.com>2021-07-22 11:43:23 -0500
commitb62366181a5e9473e9c10e98f400049491c55876 (patch)
tree89872d334ee61e3751fe03e4d7f0f5ea4389ce16 /fs/cifs/fs_context.c
parent2485bd7557a7edb4520b4072af464f0a08c8efe0 (diff)
downloadlinux-rpi-b62366181a5e9473e9c10e98f400049491c55876.tar.gz
linux-rpi-b62366181a5e9473e9c10e98f400049491c55876.tar.bz2
linux-rpi-b62366181a5e9473e9c10e98f400049491c55876.zip
cifs: support share failover when remounting
When remouting a DFS share, force a new DFS referral of the path and if the currently cached targets do not match any of the new targets or there was no cached targets, then mark it for reconnect. For example: $ mount //dom/dfs/link /mnt -o username=foo,password=bar $ ls /mnt oldfile.txt change target share of 'link' in server settings $ mount /mnt -o remount,username=foo,password=bar $ ls /mnt newfile.txt Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/fs_context.c')
-rw-r--r--fs/cifs/fs_context.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index 553adfbcc22a..9a59d7ff9a11 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -13,6 +13,9 @@
#include <linux/magic.h>
#include <linux/security.h>
#include <net/net_namespace.h>
+#ifdef CONFIG_CIFS_DFS_UPCALL
+#include "dfs_cache.h"
+#endif
*/
#include <linux/ctype.h>
@@ -779,6 +782,10 @@ static int smb3_reconfigure(struct fs_context *fc)
smb3_cleanup_fs_context_contents(cifs_sb->ctx);
rc = smb3_fs_context_dup(cifs_sb->ctx, ctx);
smb3_update_mnt_flags(cifs_sb);
+#ifdef CONFIG_CIFS_DFS_UPCALL
+ if (!rc)
+ rc = dfs_cache_remount_fs(cifs_sb);
+#endif
return rc;
}