diff options
author | Aurelien Aptel <aaptel@suse.com> | 2018-09-20 21:10:25 -0400 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2018-10-23 22:16:05 -0400 |
commit | 8393072bab060f0a05888ee31543175d44b5dde0 (patch) | |
tree | cfc22288674c170a1699b78fa752baaa82071aa4 | |
parent | 9e1a37dad4f3b9f1d36d9fd27021bbd67fb8c85f (diff) |
CIFS: make 'nodfs' mount opt a superblock flag
tcon->Flags is only used by SMB1 code and changing it is not permanent
(you lose the setting on tcon reconnect).
* Move the setting to superblock flags (per mount-points).
* Make automount callback exit early when flag present
* Make dfs resolving happening in mount syscall exit early if flag present
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Pavel Shilovsky <pshilov@microsoft.com>
-rw-r--r-- | fs/cifs/cifs_dfs_ref.c | 7 | ||||
-rw-r--r-- | fs/cifs/cifs_fs_sb.h | 1 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 2 | ||||
-rw-r--r-- | fs/cifs/connect.c | 9 |
4 files changed, 14 insertions, 5 deletions
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index 6b61df117fd4..b97c74efd04a 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
@@ -304,12 +304,17 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) | |||
304 | */ | 304 | */ |
305 | mnt = ERR_PTR(-ENOMEM); | 305 | mnt = ERR_PTR(-ENOMEM); |
306 | 306 | ||
307 | cifs_sb = CIFS_SB(mntpt->d_sb); | ||
308 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) { | ||
309 | mnt = ERR_PTR(-EREMOTE); | ||
310 | goto cdda_exit; | ||
311 | } | ||
312 | |||
307 | /* always use tree name prefix */ | 313 | /* always use tree name prefix */ |
308 | full_path = build_path_from_dentry_optional_prefix(mntpt, true); | 314 | full_path = build_path_from_dentry_optional_prefix(mntpt, true); |
309 | if (full_path == NULL) | 315 | if (full_path == NULL) |
310 | goto cdda_exit; | 316 | goto cdda_exit; |
311 | 317 | ||
312 | cifs_sb = CIFS_SB(mntpt->d_sb); | ||
313 | tlink = cifs_sb_tlink(cifs_sb); | 318 | tlink = cifs_sb_tlink(cifs_sb); |
314 | if (IS_ERR(tlink)) { | 319 | if (IS_ERR(tlink)) { |
315 | mnt = ERR_CAST(tlink); | 320 | mnt = ERR_CAST(tlink); |
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index 9731d0d891e7..63d7530f2e1d 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h | |||
@@ -51,6 +51,7 @@ | |||
51 | */ | 51 | */ |
52 | #define CIFS_MOUNT_UID_FROM_ACL 0x2000000 /* try to get UID via special SID */ | 52 | #define CIFS_MOUNT_UID_FROM_ACL 0x2000000 /* try to get UID via special SID */ |
53 | #define CIFS_MOUNT_NO_HANDLE_CACHE 0x4000000 /* disable caching dir handles */ | 53 | #define CIFS_MOUNT_NO_HANDLE_CACHE 0x4000000 /* disable caching dir handles */ |
54 | #define CIFS_MOUNT_NO_DFS 0x8000000 /* disable DFS resolving */ | ||
54 | 55 | ||
55 | struct cifs_sb_info { | 56 | struct cifs_sb_info { |
56 | struct rb_root tlink_tree; | 57 | struct rb_root tlink_tree; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index ba0054604f85..d2f9bc48ffac 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -500,6 +500,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) | |||
500 | seq_puts(s, ",unix"); | 500 | seq_puts(s, ",unix"); |
501 | else | 501 | else |
502 | seq_puts(s, ",nounix"); | 502 | seq_puts(s, ",nounix"); |
503 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) | ||
504 | seq_puts(s, ",nodfs"); | ||
503 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | 505 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) |
504 | seq_puts(s, ",posixpaths"); | 506 | seq_puts(s, ",posixpaths"); |
505 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) | 507 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 106d3a85f77b..6221aef45ff5 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -3086,10 +3086,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) | |||
3086 | if (rc) | 3086 | if (rc) |
3087 | goto out_fail; | 3087 | goto out_fail; |
3088 | 3088 | ||
3089 | if (volume_info->nodfs) { | ||
3090 | tcon->Flags &= ~SMB_SHARE_IS_IN_DFS; | ||
3091 | cifs_dbg(FYI, "DFS disabled (%d)\n", tcon->Flags); | ||
3092 | } | ||
3093 | tcon->use_persistent = false; | 3089 | tcon->use_persistent = false; |
3094 | /* check if SMB2 or later, CIFS does not support persistent handles */ | 3090 | /* check if SMB2 or later, CIFS does not support persistent handles */ |
3095 | if (volume_info->persistent) { | 3091 | if (volume_info->persistent) { |
@@ -3664,6 +3660,8 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | |||
3664 | cifs_sb->actimeo = pvolume_info->actimeo; | 3660 | cifs_sb->actimeo = pvolume_info->actimeo; |
3665 | cifs_sb->local_nls = pvolume_info->local_nls; | 3661 | cifs_sb->local_nls = pvolume_info->local_nls; |
3666 | 3662 | ||
3663 | if (pvolume_info->nodfs) | ||
3664 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_DFS; | ||
3667 | if (pvolume_info->noperm) | 3665 | if (pvolume_info->noperm) |
3668 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; | 3666 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; |
3669 | if (pvolume_info->setuids) | 3667 | if (pvolume_info->setuids) |
@@ -3820,6 +3818,9 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, | |||
3820 | struct dfs_info3_param *referrals = NULL; | 3818 | struct dfs_info3_param *referrals = NULL; |
3821 | char *full_path = NULL, *ref_path = NULL, *mdata = NULL; | 3819 | char *full_path = NULL, *ref_path = NULL, *mdata = NULL; |
3822 | 3820 | ||
3821 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) | ||
3822 | return -EREMOTE; | ||
3823 | |||
3823 | full_path = build_unc_path_to_root(volume_info, cifs_sb); | 3824 | full_path = build_unc_path_to_root(volume_info, cifs_sb); |
3824 | if (IS_ERR(full_path)) | 3825 | if (IS_ERR(full_path)) |
3825 | return PTR_ERR(full_path); | 3826 | return PTR_ERR(full_path); |