Subject: RE: linux-next: build failure after merge of the cifsd tree

From: "Namjae Jeon" <[email-masked]>
Date: Wed, 17 Mar 2021 17:19:53 +0900

Hi Stephen,
> Hi all,
> 
> After merging the cifsd tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
> 
> ld: fs/cifsd/misc.o:(.opd+0xc0): multiple definition of `extract_sharename'; fs/cifs/unc.o:(.opd+0x18):
> first defined here
> ld: fs/cifsd/misc.o: in function `.extract_sharename':
> misc.c:(.text.extract_sharename+0x0): multiple definition of `.extract_sharename';
> fs/cifs/unc.o:unc.c:(.text.extract_sharename+0x0): first defined here
> 
> Caused by commit
> 
>   cabcebc31de4 ("cifsd: introduce SMB3 kernel server")
> 
> I applied the following patch for today:
I send a pull request included this patch to Steve.

Thanks for your patch.
> 
> From: Stephen Rothwell <[email-masked]>
> Date: Wed, 17 Mar 2021 18:35:55 +1100
> Subject: [PATCH] cifsd: uniquify extract_sharename()
> 
> Signed-off-by: Stephen Rothwell <[email-masked]>
> ---
>  fs/cifsd/misc.c    | 4 ++--
>  fs/cifsd/misc.h    | 2 +-
>  fs/cifsd/smb2pdu.c | 2 +-
>  fs/cifsd/unicode.h | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/cifsd/misc.c b/fs/cifsd/misc.c index 9e689c33f7bb..2e83cfc43be9 100644
> --- a/fs/cifsd/misc.c
> +++ b/fs/cifsd/misc.c
> @@ -210,12 +210,12 @@ void ksmbd_conv_path_to_windows(char *path)  }
> 
>  /**
> - * extract_sharename() - get share name from tree connect request
> + * cifsd_extract_sharename() - get share name from tree connect request
>   * @treename:	buffer containing tree name and share name
>   *
>   * Return:      share name on success, otherwise error
>   */
> -char *extract_sharename(char *treename)
> +char *cifsd_extract_sharename(char *treename)
>  {
>  	char *name = treename;
>  	char *dst;
> diff --git a/fs/cifsd/misc.h b/fs/cifsd/misc.h index d67843aad509..4cb0d4bebb21 100644
> --- a/fs/cifsd/misc.h
> +++ b/fs/cifsd/misc.h
> @@ -25,7 +25,7 @@ void ksmbd_conv_path_to_unix(char *path);  void ksmbd_strip_last_slash(char *path);
> void ksmbd_conv_path_to_windows(char *path);
> 
> -char *extract_sharename(char *treename);
> +char *cifsd_extract_sharename(char *treename);
> 
>  char *convert_to_unix_name(struct ksmbd_share_config *share, char *name);
> 
> diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c index b20cc07ee809..3da96ebeae8b 100644
> --- a/fs/cifsd/smb2pdu.c
> +++ b/fs/cifsd/smb2pdu.c
> @@ -1709,7 +1709,7 @@ int smb2_tree_connect(struct ksmbd_work *work)
>  		goto out_err1;
>  	}
> 
> -	name = extract_sharename(treename);
> +	name = cifsd_extract_sharename(treename);
>  	if (IS_ERR(name)) {
>  		status.ret = KSMBD_TREE_CONN_STATUS_ERROR;
>  		goto out_err1;
> diff --git a/fs/cifsd/unicode.h b/fs/cifsd/unicode.h index 228a02c9b95d..16269c098f86 100644
> --- a/fs/cifsd/unicode.h
> +++ b/fs/cifsd/unicode.h
> @@ -69,7 +69,7 @@ char *smb_strndup_from_utf16(const char *src, const int maxlen,
>  		const struct nls_table *codepage);
>  extern int smbConvertToUTF16(__le16 *target, const char *source, int srclen,
>  		const struct nls_table *cp, int mapchars); -extern char *extract_sharename(char
> *treename);
> +extern char *cifsd_extract_sharename(char *treename);
>  #endif
> 
>  wchar_t cifs_toupper(wchar_t in);
> --
> 2.30.0
> 
> --
> Cheers,
> Stephen Rothwell