diff mbox series

[4/4] cifs: fix nodfs mount option

Message ID 20210224235924.29931-4-pc@cjr.nz (mailing list archive)
State New, archived
Headers show
Series [1/4] cifs: fix DFS failover | expand

Commit Message

Paulo Alcantara Feb. 24, 2021, 11:59 p.m. UTC
Skip DFS resolving when mounting with 'nodfs' even if
CONFIG_CIFS_DFS_UPCALL is enabled.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
---
 fs/cifs/connect.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Shyam Prasad N Feb. 25, 2021, 6:04 a.m. UTC | #1
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>

On Thu, Feb 25, 2021 at 10:16 AM Paulo Alcantara <pc@cjr.nz> wrote:
>
> Skip DFS resolving when mounting with 'nodfs' even if
> CONFIG_CIFS_DFS_UPCALL is enabled.
>
> Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
> ---
>  fs/cifs/connect.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 37452b2e24b8..6ab5f96fe1b4 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3373,15 +3373,15 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
>
>         rc = mount_get_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon);
>         /*
> -        * Unconditionally try to get an DFS referral (even cached) to determine whether it is an
> -        * DFS mount.
> +        * If called with 'nodfs' mount option, then skip DFS resolving.  Otherwise unconditionally
> +        * try to get an DFS referral (even cached) to determine whether it is an DFS mount.
>          *
>          * Skip prefix path to provide support for DFS referrals from w2k8 servers which don't seem
>          * to respond with PATH_NOT_COVERED to requests that include the prefix.
>          */
> -       if (dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), ctx->UNC + 1, NULL,
> +       if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) ||
> +           dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), ctx->UNC + 1, NULL,
>                            NULL)) {
> -               /* No DFS referral was returned.  Looks like a regular share. */
>                 if (rc)
>                         goto error;
>                 /* Check if it is fully accessible and then mount it */
> --
> 2.30.1
>
diff mbox series

Patch

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 37452b2e24b8..6ab5f96fe1b4 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3373,15 +3373,15 @@  int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
 
 	rc = mount_get_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon);
 	/*
-	 * Unconditionally try to get an DFS referral (even cached) to determine whether it is an
-	 * DFS mount.
+	 * If called with 'nodfs' mount option, then skip DFS resolving.  Otherwise unconditionally
+	 * try to get an DFS referral (even cached) to determine whether it is an DFS mount.
 	 *
 	 * Skip prefix path to provide support for DFS referrals from w2k8 servers which don't seem
 	 * to respond with PATH_NOT_COVERED to requests that include the prefix.
 	 */
-	if (dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), ctx->UNC + 1, NULL,
+	if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) ||
+	    dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), ctx->UNC + 1, NULL,
 			   NULL)) {
-		/* No DFS referral was returned.  Looks like a regular share. */
 		if (rc)
 			goto error;
 		/* Check if it is fully accessible and then mount it */