[PATCH] mount, cifs bug in 1.20.2 Kernel > 3.3.7

Martin Santesson martin.santesson at axis.com
Mon Nov 12 14:56:24 UTC 2012


On 10/30/2012 03:53 PM, Martin Santesson wrote:
> On Fri, 26 Oct 2012, Nuno Lucas wrote:
>
>    
>> Hello,
>>
>> On Wed, Oct 24, 2012 at 10:27 AM,<bbj17 at gmx.de>  wrote:
>>      
>>> Hi,
>>>
>>> I have the following problem:
>>>
>>> -Busybox 1.20.2 (Buildroot 2012.08)
>>> -Target Kernel: 3.4.7
>>>
>>> on Target:
>>> mount -t cifs //server/share /destination -o username=xxx,password=xxx
>>>
>>> result (terminal):
>>> mount: mounting //server/share /destination  failed: Invalid argument
>>>
>>> result(dmesg):
>>> CIFS VFS: Connecting to DFS root not implemented yet
>>>
>>> when i use kernel 3.3.7 everything is fine. Same problem with kernel 3.4.15 and 3.6.3.
>>>
>>> When I use buildroot cifs-utils (mount.cifs) instead of busybox "mount" everything is fine.
>>>        
>> I got this problem some time ago, too.
>>
>> Someone in kernel land decided that the option "unc=\\machine\share"
>> is now mandatory since 3.4.
>> It seems to ignore the Unix-style share passed as parameter and only
>> care about the "unc" option (which must have the windows style '\\'s).
>>
>> I didn't thought much about it (it's a regression in the kernel, but
>> it's too late in the game now), and that's how I worked around it.
>>
>>
>> Regards,
>> ~Nuno Lucas
>>
>>      
> Hi,
>
> I also ran into this problem. I wrote a patch which supplies the unc
> option the kernel. Tested with Linux kernel 2.6.35, 3.2 (prior to
> mandatory unc option) and 3.4. Please have a look at my patch and let me
> know if it needs to be revised.
>
> Regards,
>
> Martin
>
> > From fa16a76caebf1dfda1db81f0885e101624ac1462 Mon Sep 17 00:00:00 2001
> From: Martin Santesson<martinsn at axis.com>
> Date: Fri, 26 Oct 2012 09:40:04 +0200
> Subject: [PATCH] mount: add unc option to CIFS mount (needed for Linux 3.4+)
>
> unc option for CIFS mount is mandatory after CIFS option parsing
> was rewritten in Linux 3.4
>
> Signed-off-by: Martin Santesson<martinsn at axis.com>
> ---
>    busybox/util-linux/mount.c |   11 ++++++++++-
>    1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/busybox/util-linux/mount.c b/busybox/util-linux/mount.c
> index 0f213bb..d990ebc 100644
> --- a/busybox/util-linux/mount.c
> +++ b/busybox/util-linux/mount.c
> @@ -1638,7 +1638,7 @@ static int singlemount(struct mntent *mp, int ignore_busy)
>    		int len;
>    		char c;
>    		len_and_sockaddr *lsa;
> -		char *hostname, *dotted, *ip;
> +		char *hostname, *dotted, *ip, *share, *unc;
>
>    		hostname = mp->mnt_fsname + 2;
>    		len = strcspn(hostname, "/\\");
> @@ -1646,6 +1646,15 @@ static int singlemount(struct mntent *mp, int ignore_busy)
>    			goto report_error;
>    		c = hostname[len];
>    		hostname[len] = '\0';
> +
> +		share = hostname + len + 1;
> +		if (share[0] == '\0')
> +			goto report_error;
> +		// Insert "unc=\\hostname\share" option into options
> +		unc = xasprintf("unc=\\\\%s\\%s", hostname, share);
> +		parse_mount_options(unc,&filteropts);
> +		if (ENABLE_FEATURE_CLEAN_UP) free(unc);
> +
>    		lsa = host2sockaddr(hostname, 0);
>    		hostname[len] = c;
>    		if (!lsa)
>    

Any other feedback on this patch?

Regards,

Martin


More information about the busybox mailing list