All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Aurelien Aptel <aaptel-IBi9RG/b67k@public.gmane.org>
Cc: linux-cifs <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v3 2/7] CIFS: add build_path_from_dentry_optional_prefix()
Date: Tue, 28 Feb 2017 18:35:28 -0800	[thread overview]
Message-ID: <CAKywueTYXeLPv61HQxftXtpuR+JX5nmZw3nMXD_5nCneamkAzA@mail.gmail.com> (raw)
In-Reply-To: <20170228184034.18771-3-aaptel-IBi9RG/b67k@public.gmane.org>

2017-02-28 10:40 GMT-08:00 Aurelien Aptel <aaptel-IBi9RG/b67k@public.gmane.org>:
> this function does the same thing as add build_path_from_dentry() but
> takes a boolean parameter to decide whether or not to prefix the path
> with the tree name.
>
> we cannot rely on tcon->Flags & SMB_SHARE_IS_IN_DFS for SMB2 as smb2
> code never sets tcon->Flags but it sets tcon->share_flags and it seems
> the SMB_SHARE_IS_IN_DFS has different semantics in SMB2: the prefix
> shouldn't be added everytime it was in SMB1.
>
> Signed-off-by: Aurelien Aptel <aaptel-IBi9RG/b67k@public.gmane.org>
> ---
>  fs/cifs/cifs_dfs_ref.c |  4 +++-
>  fs/cifs/cifsproto.h    |  2 ++
>  fs/cifs/dir.c          | 13 ++++++++++++-
>  3 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
> index ec9dbbc..8a9ebfd 100644
> --- a/fs/cifs/cifs_dfs_ref.c
> +++ b/fs/cifs/cifs_dfs_ref.c
> @@ -302,7 +302,9 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
>          * gives us the latter, so we must adjust the result.
>          */
>         mnt = ERR_PTR(-ENOMEM);
> -       full_path = build_path_from_dentry(mntpt);
> +
> +       /* always use tree name prefix */
> +       full_path = build_path_from_dentry_optional_prefix(mntpt, true);
>         if (full_path == NULL)
>                 goto cdda_exit;
>
> diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
> index c097830..9ee46c1 100644
> --- a/fs/cifs/cifsproto.h
> +++ b/fs/cifs/cifsproto.h
> @@ -61,6 +61,8 @@ extern void exit_cifs_idmap(void);
>  extern int init_cifs_spnego(void);
>  extern void exit_cifs_spnego(void);
>  extern char *build_path_from_dentry(struct dentry *);
> +extern char *build_path_from_dentry_optional_prefix(struct dentry *direntry,
> +                                                   bool prefix);
>  extern char *cifs_build_path_to_root(struct smb_vol *vol,
>                                      struct cifs_sb_info *cifs_sb,
>                                      struct cifs_tcon *tcon,
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index 2c227a9..56366e9 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -81,6 +81,17 @@ cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
>  char *
>  build_path_from_dentry(struct dentry *direntry)
>  {
> +       struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
> +       struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
> +       bool prefix = tcon->Flags & SMB_SHARE_IS_IN_DFS;
> +
> +       return build_path_from_dentry_optional_prefix(direntry,
> +                                                     prefix);
> +}
> +
> +char *
> +build_path_from_dentry_optional_prefix(struct dentry *direntry, bool prefix)
> +{
>         struct dentry *temp;
>         int namelen;
>         int dfsplen;
> @@ -92,7 +103,7 @@ build_path_from_dentry(struct dentry *direntry)
>         unsigned seq;
>
>         dirsep = CIFS_DIR_SEP(cifs_sb);
> -       if (tcon->Flags & SMB_SHARE_IS_IN_DFS)
> +       if (prefix)
>                 dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
>         else
>                 dfsplen = 0;
> --
> 2.10.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Acked-by: Pavel Shilovsky <pshilov-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>

-- 
Best regards,
Pavel Shilovsky

  parent reply	other threads:[~2017-03-01  2:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 18:40 [PATCH v3 0/7] Add support for DFS in SMB2+ Aurelien Aptel
     [not found] ` <20170228184034.18771-1-aaptel-IBi9RG/b67k@public.gmane.org>
2017-02-28 18:40   ` [PATCH v3 1/7] CIFS: move DFS response parsing out of SMB1 code Aurelien Aptel
     [not found]     ` <20170228184034.18771-2-aaptel-IBi9RG/b67k@public.gmane.org>
2017-03-01  1:58       ` Pavel Shilovsky
2017-02-28 18:40   ` [PATCH v3 2/7] CIFS: add build_path_from_dentry_optional_prefix() Aurelien Aptel
     [not found]     ` <20170228184034.18771-3-aaptel-IBi9RG/b67k@public.gmane.org>
2017-03-01  2:35       ` Pavel Shilovsky [this message]
2017-02-28 18:40   ` [PATCH v3 3/7] CIFS: add use_ipc flag to SMB2_ioctl() Aurelien Aptel
     [not found]     ` <20170228184034.18771-4-aaptel-IBi9RG/b67k@public.gmane.org>
2017-03-01  2:36       ` Pavel Shilovsky
2017-02-28 18:40   ` [PATCH v3 4/7] CIFS: let ses->ipc_tid hold smb2 TreeIds Aurelien Aptel
     [not found]     ` <20170228184034.18771-5-aaptel-IBi9RG/b67k@public.gmane.org>
2017-03-01  2:36       ` Pavel Shilovsky
2017-02-28 18:40   ` [PATCH v3 5/7] CIFS: set signing flag in SMB2+ TreeConnect if needed Aurelien Aptel
     [not found]     ` <20170228184034.18771-6-aaptel-IBi9RG/b67k@public.gmane.org>
2017-03-01  2:37       ` Pavel Shilovsky
2017-02-28 18:40   ` [PATCH v3 6/7] CIFS: use DFS pathnames in SMB2+ Create requests Aurelien Aptel
     [not found]     ` <20170228184034.18771-7-aaptel-IBi9RG/b67k@public.gmane.org>
2017-03-01  2:40       ` Pavel Shilovsky
2017-02-28 18:40   ` [PATCH v3 7/7] CIFS: implement get_dfs_refer for SMB2+ Aurelien Aptel
     [not found]     ` <20170228184034.18771-8-aaptel-IBi9RG/b67k@public.gmane.org>
2017-03-01  2:42       ` Pavel Shilovsky
2017-06-22 23:03       ` Pavel Shilovsky
     [not found]         ` <CAKywueTx4b4+MDYeTm+jBsUZfmYe+Sa1HT9cUx-d4043hKxr+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-22 23:05           ` Pavel Shilovsky
     [not found]             ` <CAKywueSy1Y1PNLHkRnDbxgc+Kf1qe_H65DPkWpX-=k=Enu-VUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-23  9:19               ` Aurélien Aptel
2017-03-02  4:41   ` [PATCH v3 0/7] Add support for DFS in SMB2+ Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKywueTYXeLPv61HQxftXtpuR+JX5nmZw3nMXD_5nCneamkAzA@mail.gmail.com \
    --to=piastryyy-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=aaptel-IBi9RG/b67k@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.