Skip to contentSkip to conversation

3.4.0-rc2+: CIFS - strange file modes

PATCH In review Chris Clayton 4 participants 5 messages Apr 13, 2012 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I'm running a kernel built from a pull from Linus last night (v3.4-rc2-174-gecca5c3), patched with Sachin Prabhu's " Cleanup handling of NULL value passed for a mount option" patch, which hasn't made it to Linus yet.

When I mount a partition on a small nas, I see strange file modes as is shown below:

[chris:~]$ uname -r
3.4.0-rc2+
[chris:~]$ sudo mount /media/nas/share
[chris:~]$ cp IMAG014* /media/nas/share/chris/upstairs/
[chris:~]$ ls -l /media/nas/share/chris/upstairs/
total 3980
drwxr-xr-x 2 chris users       0 Apr 13 06:55 ./
drwxr-xr-x 2 chris users       0 Apr  5 12:01 ../
--w--wx-wT 1 chris users 1255508 Apr 13 06:55 IMAG0147.jpg*
--w--wx-wT 1 chris users 1388786 Apr 13 06:55 IMAG0148.jpg*
--w--wx-wT 1 chris users 1430092 Apr 13 06:55 IMAG0149.jpg*

The related line in fstab is:

//nas/Share /media/nas/share cifs
rw,noauto,noserverino,nosuid,nodev,user,guest,uid=1002,gid=100,file_mode=0666 0 0

When I reboot into 3.3.1, the same files look fine:

[chris:~]$ uname -r
3.3.1
[chris:~]$ sudo mount /media/nas/share
[chris:~]$ ls -l /media/nas/share/chris/upstairs/
total 3980
drwxr-xr-x 2 chris users       0 Apr 13 06:55 ./
drwxr-xr-x 2 chris users       0 Apr  5 12:01 ../
-rw-rw-rw- 1 chris users 1255508 Apr 13 06:55 IMAG0147.jpg
-rw-rw-rw- 1 chris users 1388786 Apr 13 06:55 IMAG0148.jpg
-rw-rw-rw- 1 chris users 1430092 Apr 13 06:55 IMAG0149.jpg

Let me know if I can help in fixing this regression.

Please cc me on any reply - I'm not subscribed.

Chris

Signature · 1 line
The more I see, the more I know. The more I know, the less I understand. Changing Man - Paul Weller

A message that is not in the archive (sent off-list or not yet received): 201204130712.51693.chris2553-gM/[email protected]

#2 lore raw

PATCH 1/1 Fix number parsing in cifs_parse_mount_options

The function kstrtoul() used to parse number strings in the mount option parser is set to expect a base 10 number . This treats the octal numbers passed for mount options such as file_mode as base10 numbers leading to incorrect behavior.

Change the 'base' argument passed to kstrtoul from 10 to 0 to allow it to auto-detect the base of the number passed.

---
 fs/cifs/connect.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/cifs/connect.c +1 -1
index 6a86f3d..f31dc9a 100644
@@ -1123,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
 	string = match_strdup(args);
 	if (string == NULL)
 		return -ENOMEM;
-	rc = kstrtoul(string, 10, option);
+	rc = kstrtoul(string, 0, option);
 	kfree(string);
 
 	return rc;
Signature · 1 line
1.7.7.6
Acked-by on v1 1/1
#3 lore raw

Re: [PATCH] Fix number parsing in cifs_parse_mount_options

Quoted 20 lines · On Fri, 13 Apr 2012 14:04:32 +0100 Sachin Prabhu…

The function kstrtoul() used to parse number strings in the mount option parser is set to expect a base 10 number . This treats the octal numbers passed for mount options such as file_mode as base10 numbers leading to incorrect behavior.

Change the 'base' argument passed to kstrtoul from 10 to 0 to allow it to auto-detect the base of the number passed.

---
 fs/cifs/connect.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/cifs/connect.c +0 -0
index 6a86f3d..f31dc9a 100644

fs/cifs/connect.c static int get_option_ul(substring_t args[], unsigned long *option) · line 1129

Quoted 8 lines
fs/cifs/connect.c +1 -1
@@ -1123,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
 	string = match_strdup(args);
 	if (string == NULL)
 		return -ENOMEM;
-	rc = kstrtoul(string, 10, option);
+	rc = kstrtoul(string, 0, option);
 	kfree(string);
 
 	return rc;

A message that is not in the archive (sent off-list or not yet received): 20120413091753.60dccc93-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org

#5 lore raw

Re: [PATCH] Fix number parsing in cifs_parse_mount_options

Merged

Quoted 37 lines · Jeff Layton
Quoted 20 lines · On Fri, 13 Apr 2012 14:04:32 +0100 Sachin Prabhu…

The function kstrtoul() used to parse number strings in the mount option parser is set to expect a base 10 number . This treats the octal numbers passed for mount options such as file_mode as base10 numbers leading to incorrect behavior.

Change the 'base' argument passed to kstrtoul from 10 to 0 to allow it to auto-detect the base of the number passed.

---
 fs/cifs/connect.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
fs/cifs/connect.c +0 -0
index 6a86f3d..f31dc9a 100644

fs/cifs/connect.c static int get_option_ul(substring_t args[], unsigned long *option) · line 1129

Quoted 8 lines
fs/cifs/connect.c +1 -1
@@ -1123,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
       string = match_strdup(args);
       if (string == NULL)
               return -ENOMEM;
-     rc = kstrtoul(string, 10, option);
+     rc = kstrtoul(string, 0, option);
       kfree(string);
 
       return rc;

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Thanks,

Steve
author Tested-by on v1 1/1
#6 lore raw

Re: [PATCH] Fix number parsing in cifs_parse_mount_options

In reply to Sachin Prabhu
Quoted 20 lines · Sachin Prabhu

The function kstrtoul() used to parse number strings in the mount option parser is set to expect a base 10 number . This treats the octal numbers passed for mount options such as file_mode as base10 numbers leading to incorrect behavior.

Change the 'base' argument passed to kstrtoul from 10 to 0 to allow it to auto-detect the base of the number passed.

---
  fs/cifs/connect.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
fs/cifs/connect.c +0 -0
index 6a86f3d..f31dc9a 100644

fs/cifs/connect.c static int get_option_ul(substring_t args[], unsigned long *option) · line 1129

Quoted 8 lines
fs/cifs/connect.c +1 -1
@@ -1123,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
  	string = match_strdup(args);
  	if (string == NULL)
  		return -ENOMEM;
-	rc = kstrtoul(string, 10, option);
+	rc = kstrtoul(string, 0, option);
  	kfree(string);
 
  	return rc;

Yes, that's fixed it. Thanks again, Sachin.