diff mbox series

[4/4] smb: client: improve DFS mount check

Message ID 20230628002450.18781-4-pc@manguebit.com (mailing list archive)
State New, archived
Headers show
Series [1/4] smb: client: fix parsing of source mount option | expand

Commit Message

Paulo Alcantara June 28, 2023, 12:24 a.m. UTC
Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
that are unexpected by the client, so to make it easier, assume
non-DFS mounts when the client can't get the initial DFS referral of
@ctx->UNC in dfs_mount_share().

Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
---
 fs/smb/client/dfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Steve French June 28, 2023, 3:51 a.m. UTC | #1
tentatively merged all 4 into cifs-2.6.git for-next pending additional
review and testing

On Tue, Jun 27, 2023 at 7:25 PM Paulo Alcantara <pc@manguebit.com> wrote:
>
> Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
> that are unexpected by the client, so to make it easier, assume
> non-DFS mounts when the client can't get the initial DFS referral of
> @ctx->UNC in dfs_mount_share().
>
> Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
> ---
>  fs/smb/client/dfs.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
> index afbaef05a1f1..a7f2e0608adf 100644
> --- a/fs/smb/client/dfs.c
> +++ b/fs/smb/client/dfs.c
> @@ -264,8 +264,9 @@ int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx, bool *isdfs)
>         if (!nodfs) {
>                 rc = dfs_get_referral(mnt_ctx, ctx->UNC + 1, NULL, NULL);
>                 if (rc) {
> -                       if (rc != -ENOENT && rc != -EOPNOTSUPP && rc != -EIO)
> -                               return rc;
> +                       cifs_dbg(FYI, "%s: no dfs referral for %s: %d\n",
> +                                __func__, ctx->UNC + 1, rc);
> +                       cifs_dbg(FYI, "%s: assuming non-dfs mount...\n", __func__);
>                         nodfs = true;
>                 }
>         }
> --
> 2.41.0
>
Paulo Alcantara July 12, 2023, 9:10 p.m. UTC | #2
Paulo Alcantara <pc@manguebit.com> writes:

> Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
> that are unexpected by the client, so to make it easier, assume
> non-DFS mounts when the client can't get the initial DFS referral of
> @ctx->UNC in dfs_mount_share().
>
> Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
> ---
>  fs/smb/client/dfs.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
> index afbaef05a1f1..a7f2e0608adf 100644

Stable team, could you please pick this up as a fix for

        8e3554150d6c ("cifs: fix sharing of DFS connections")

The upstream commit is 5f2a0afa9890 ("smb: client: improve DFS mount check").

Thanks.
Greg Kroah-Hartman July 13, 2023, 5:41 a.m. UTC | #3
On Wed, Jul 12, 2023 at 06:10:27PM -0300, Paulo Alcantara wrote:
> Paulo Alcantara <pc@manguebit.com> writes:
> 
> > Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
> > that are unexpected by the client, so to make it easier, assume
> > non-DFS mounts when the client can't get the initial DFS referral of
> > @ctx->UNC in dfs_mount_share().
> >
> > Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
> > ---
> >  fs/smb/client/dfs.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
> > index afbaef05a1f1..a7f2e0608adf 100644
> 
> Stable team, could you please pick this up as a fix for
> 
>         8e3554150d6c ("cifs: fix sharing of DFS connections")
> 
> The upstream commit is 5f2a0afa9890 ("smb: client: improve DFS mount check").

Does not apply cleanly, can you provide a working backport?

thanks,

greg k-h
Paulo Alcantara July 13, 2023, 9:48 p.m. UTC | #4
Hi Greg,

Greg KH <gregkh@linuxfoundation.org> writes:

> On Wed, Jul 12, 2023 at 06:10:27PM -0300, Paulo Alcantara wrote:
>> Paulo Alcantara <pc@manguebit.com> writes:
>> 
>> > Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
>> > that are unexpected by the client, so to make it easier, assume
>> > non-DFS mounts when the client can't get the initial DFS referral of
>> > @ctx->UNC in dfs_mount_share().
>> >
>> > Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
>> > ---
>> >  fs/smb/client/dfs.c | 5 +++--
>> >  1 file changed, 3 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
>> > index afbaef05a1f1..a7f2e0608adf 100644
>> 
>> Stable team, could you please pick this up as a fix for
>> 
>>         8e3554150d6c ("cifs: fix sharing of DFS connections")
>> 
>> The upstream commit is 5f2a0afa9890 ("smb: client: improve DFS mount check").
>
> Does not apply cleanly, can you provide a working backport?

Find attached backport of
5f2a0afa9890 ("smb: client: improve DFS mount check").

for v6.3.y.

And for v6.4.y, please take these

    d439b29057e2 ("smb: client: fix broken file attrs with nodfs mounts")
    49024ec8795e ("smb: client: fix parsing of source mount option")
    3ae872de4107 ("smb: client: fix shared DFS root mounts with different prefixes")
    49024ec8795e ("smb: client: fix parsing of source mount option")

Thanks.
Greg Kroah-Hartman July 16, 2023, 7:10 p.m. UTC | #5
On Thu, Jul 13, 2023 at 06:48:00PM -0300, Paulo Alcantara wrote:
> Hi Greg,
> 
> Greg KH <gregkh@linuxfoundation.org> writes:
> 
> > On Wed, Jul 12, 2023 at 06:10:27PM -0300, Paulo Alcantara wrote:
> >> Paulo Alcantara <pc@manguebit.com> writes:
> >> 
> >> > Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
> >> > that are unexpected by the client, so to make it easier, assume
> >> > non-DFS mounts when the client can't get the initial DFS referral of
> >> > @ctx->UNC in dfs_mount_share().
> >> >
> >> > Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
> >> > ---
> >> >  fs/smb/client/dfs.c | 5 +++--
> >> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
> >> > index afbaef05a1f1..a7f2e0608adf 100644
> >> 
> >> Stable team, could you please pick this up as a fix for
> >> 
> >>         8e3554150d6c ("cifs: fix sharing of DFS connections")
> >> 
> >> The upstream commit is 5f2a0afa9890 ("smb: client: improve DFS mount check").
> >
> > Does not apply cleanly, can you provide a working backport?
> 
> Find attached backport of

> >From 435048ee0f477947d1d93f5a9b60b2d2df2b7554 Mon Sep 17 00:00:00 2001
> From: Paulo Alcantara <pc@manguebit.com>
> Date: Tue, 27 Jun 2023 21:24:50 -0300
> Subject: [PATCH stable v6.3] smb: client: improve DFS mount check

I'm confused, 6.3.y is end-of-life, and:

> 
> Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
> that are unexpected by the client, so to make it easier, assume
> non-DFS mounts when the client can't get the initial DFS referral of
> @ctx->UNC in dfs_mount_share().
> 
> Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/cifs/dfs.c | 5 +++--

This file is not in the 6.4.y or any older kernel tree.

So what tree did you make this against, and where should it be applied
to?

totally confused,

greg k-h
Paulo Alcantara July 17, 2023, 3:01 p.m. UTC | #6
Greg KH <gregkh@linuxfoundation.org> writes:

> On Thu, Jul 13, 2023 at 06:48:00PM -0300, Paulo Alcantara wrote:
>> Hi Greg,
>> 
>> Greg KH <gregkh@linuxfoundation.org> writes:
>> 
>> > On Wed, Jul 12, 2023 at 06:10:27PM -0300, Paulo Alcantara wrote:
>> >> Paulo Alcantara <pc@manguebit.com> writes:
>> >> 
>> >> > Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
>> >> > that are unexpected by the client, so to make it easier, assume
>> >> > non-DFS mounts when the client can't get the initial DFS referral of
>> >> > @ctx->UNC in dfs_mount_share().
>> >> >
>> >> > Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
>> >> > ---
>> >> >  fs/smb/client/dfs.c | 5 +++--
>> >> >  1 file changed, 3 insertions(+), 2 deletions(-)
>> >> >
>> >> > diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
>> >> > index afbaef05a1f1..a7f2e0608adf 100644
>> >> 
>> >> Stable team, could you please pick this up as a fix for
>> >> 
>> >>         8e3554150d6c ("cifs: fix sharing of DFS connections")
>> >> 
>> >> The upstream commit is 5f2a0afa9890 ("smb: client: improve DFS mount check").
>> >
>> > Does not apply cleanly, can you provide a working backport?
>> 
>> Find attached backport of
>
>> >From 435048ee0f477947d1d93f5a9b60b2d2df2b7554 Mon Sep 17 00:00:00 2001
>> From: Paulo Alcantara <pc@manguebit.com>
>> Date: Tue, 27 Jun 2023 21:24:50 -0300
>> Subject: [PATCH stable v6.3] smb: client: improve DFS mount check
>
> I'm confused, 6.3.y is end-of-life, and:
>
>> 
>> Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
>> that are unexpected by the client, so to make it easier, assume
>> non-DFS mounts when the client can't get the initial DFS referral of
>> @ctx->UNC in dfs_mount_share().
>> 
>> Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
>> Signed-off-by: Steve French <stfrench@microsoft.com>
>> ---
>>  fs/cifs/dfs.c | 5 +++--
>
> This file is not in the 6.4.y or any older kernel tree.
>
> So what tree did you make this against, and where should it be applied
> to?

Err, sorry about missing the EOL of 6.3.y.  The attached patch was based
on v6.3.13 from the stable tree[1], where it didn't have the rename
from "fs/cifs" to "fs/smb/client" yet.  Please ignore the attached
patch.

So, the commit

        5f2a0afa9890 ("smb: client: improve DFS mount check")

should be applied to 6.4.y.  I've checked that it applies cleanly
against linux-6.4.y from the linux-stable-rc tree[2].

Thanks.

[1] git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[2] git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Greg Kroah-Hartman July 20, 2023, 5:56 p.m. UTC | #7
On Mon, Jul 17, 2023 at 12:01:58PM -0300, Paulo Alcantara wrote:
> Greg KH <gregkh@linuxfoundation.org> writes:
> 
> > On Thu, Jul 13, 2023 at 06:48:00PM -0300, Paulo Alcantara wrote:
> >> Hi Greg,
> >> 
> >> Greg KH <gregkh@linuxfoundation.org> writes:
> >> 
> >> > On Wed, Jul 12, 2023 at 06:10:27PM -0300, Paulo Alcantara wrote:
> >> >> Paulo Alcantara <pc@manguebit.com> writes:
> >> >> 
> >> >> > Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
> >> >> > that are unexpected by the client, so to make it easier, assume
> >> >> > non-DFS mounts when the client can't get the initial DFS referral of
> >> >> > @ctx->UNC in dfs_mount_share().
> >> >> >
> >> >> > Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
> >> >> > ---
> >> >> >  fs/smb/client/dfs.c | 5 +++--
> >> >> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >> >> >
> >> >> > diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
> >> >> > index afbaef05a1f1..a7f2e0608adf 100644
> >> >> 
> >> >> Stable team, could you please pick this up as a fix for
> >> >> 
> >> >>         8e3554150d6c ("cifs: fix sharing of DFS connections")
> >> >> 
> >> >> The upstream commit is 5f2a0afa9890 ("smb: client: improve DFS mount check").
> >> >
> >> > Does not apply cleanly, can you provide a working backport?
> >> 
> >> Find attached backport of
> >
> >> >From 435048ee0f477947d1d93f5a9b60b2d2df2b7554 Mon Sep 17 00:00:00 2001
> >> From: Paulo Alcantara <pc@manguebit.com>
> >> Date: Tue, 27 Jun 2023 21:24:50 -0300
> >> Subject: [PATCH stable v6.3] smb: client: improve DFS mount check
> >
> > I'm confused, 6.3.y is end-of-life, and:
> >
> >> 
> >> Some servers may return error codes from REQ_GET_DFS_REFERRAL requests
> >> that are unexpected by the client, so to make it easier, assume
> >> non-DFS mounts when the client can't get the initial DFS referral of
> >> @ctx->UNC in dfs_mount_share().
> >> 
> >> Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
> >> Signed-off-by: Steve French <stfrench@microsoft.com>
> >> ---
> >>  fs/cifs/dfs.c | 5 +++--
> >
> > This file is not in the 6.4.y or any older kernel tree.
> >
> > So what tree did you make this against, and where should it be applied
> > to?
> 
> Err, sorry about missing the EOL of 6.3.y.  The attached patch was based
> on v6.3.13 from the stable tree[1], where it didn't have the rename
> from "fs/cifs" to "fs/smb/client" yet.  Please ignore the attached
> patch.
> 
> So, the commit
> 
>         5f2a0afa9890 ("smb: client: improve DFS mount check")
> 
> should be applied to 6.4.y.  I've checked that it applies cleanly
> against linux-6.4.y from the linux-stable-rc tree[2].

Now queued up, thanks.

greg k-h
diff mbox series

Patch

diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
index afbaef05a1f1..a7f2e0608adf 100644
--- a/fs/smb/client/dfs.c
+++ b/fs/smb/client/dfs.c
@@ -264,8 +264,9 @@  int dfs_mount_share(struct cifs_mount_ctx *mnt_ctx, bool *isdfs)
 	if (!nodfs) {
 		rc = dfs_get_referral(mnt_ctx, ctx->UNC + 1, NULL, NULL);
 		if (rc) {
-			if (rc != -ENOENT && rc != -EOPNOTSUPP && rc != -EIO)
-				return rc;
+			cifs_dbg(FYI, "%s: no dfs referral for %s: %d\n",
+				 __func__, ctx->UNC + 1, rc);
+			cifs_dbg(FYI, "%s: assuming non-dfs mount...\n", __func__);
 			nodfs = true;
 		}
 	}