aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-03-23 14:40:56 -0400
committerJeff Layton <jlayton@redhat.com>2012-03-23 14:40:56 -0400
commitd81625587f4fac44a4367c468ba2fe2d981460f8 (patch)
tree62b20ee4d39c345b7348a8a8fdad946dfde73919 /fs/cifs
parent8830d7e07a5e38bc47650a7554b7c1cfd49902bf (diff)
cifs: handle "sloppy" option appropriately
cifs.ko has historically been tolerant of options that it does not recognize. This is not normal behavior for a filesystem however. Usually, it should only do this if you mount with '-s', and autofs generally passes -s to the mount command to allow this behavior. This patch makes cifs handle the option "sloppy" appropriately. If it's present in the options string, then the client will tolerate options that it doesn't recognize. If it's not present then the client will error out in the presence of options that it does not recognize and throw an error message explaining why. There is also a companion patch being proposed for mount.cifs to make it append "sloppy" to the mount options when passed the '-s' flag. This also should (obviously) be applied on top of Sachin's conversion to the standard option parser. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-By: Sachin Prabhu <sprabhu@redhat.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/connect.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 3d72218bd962..980815426ac6 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -88,7 +88,7 @@ enum {
88 Opt_sign, Opt_seal, Opt_direct, 88 Opt_sign, Opt_seal, Opt_direct,
89 Opt_strictcache, Opt_noac, 89 Opt_strictcache, Opt_noac,
90 Opt_fsc, Opt_mfsymlinks, 90 Opt_fsc, Opt_mfsymlinks,
91 Opt_multiuser, 91 Opt_multiuser, Opt_sloppy,
92 92
93 /* Mount options which take numeric value */ 93 /* Mount options which take numeric value */
94 Opt_backupuid, Opt_backupgid, Opt_uid, 94 Opt_backupuid, Opt_backupgid, Opt_uid,
@@ -167,6 +167,7 @@ static const match_table_t cifs_mount_option_tokens = {
167 { Opt_fsc, "fsc" }, 167 { Opt_fsc, "fsc" },
168 { Opt_mfsymlinks, "mfsymlinks" }, 168 { Opt_mfsymlinks, "mfsymlinks" },
169 { Opt_multiuser, "multiuser" }, 169 { Opt_multiuser, "multiuser" },
170 { Opt_sloppy, "sloppy" },
170 171
171 { Opt_backupuid, "backupuid=%s" }, 172 { Opt_backupuid, "backupuid=%s" },
172 { Opt_backupgid, "backupgid=%s" }, 173 { Opt_backupgid, "backupgid=%s" },
@@ -1186,6 +1187,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1186 short int override_gid = -1; 1187 short int override_gid = -1;
1187 bool uid_specified = false; 1188 bool uid_specified = false;
1188 bool gid_specified = false; 1189 bool gid_specified = false;
1190 bool sloppy = false;
1191 char *invalid = NULL;
1189 char *nodename = utsname()->nodename; 1192 char *nodename = utsname()->nodename;
1190 char *string = NULL; 1193 char *string = NULL;
1191 char *tmp_end, *value; 1194 char *tmp_end, *value;
@@ -1423,6 +1426,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1423 case Opt_multiuser: 1426 case Opt_multiuser:
1424 vol->multiuser = true; 1427 vol->multiuser = true;
1425 break; 1428 break;
1429 case Opt_sloppy:
1430 sloppy = true;
1431 break;
1426 1432
1427 /* Numeric Values */ 1433 /* Numeric Values */
1428 case Opt_backupuid: 1434 case Opt_backupuid:
@@ -1870,8 +1876,12 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1870 goto cifs_parse_mount_err; 1876 goto cifs_parse_mount_err;
1871 break; 1877 break;
1872 default: 1878 default:
1873 printk(KERN_WARNING "CIFS: Unknown mount option %s\n", 1879 /*
1874 data); 1880 * An option we don't recognize. Save it off for later
1881 * if we haven't already found one
1882 */
1883 if (!invalid)
1884 invalid = data;
1875 break; 1885 break;
1876 } 1886 }
1877 /* Free up any allocated string */ 1887 /* Free up any allocated string */
@@ -1879,6 +1889,11 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1879 string = NULL; 1889 string = NULL;
1880 } 1890 }
1881 1891
1892 if (!sloppy && invalid) {
1893 printk(KERN_ERR "CIFS: Unknown mount option \"%s\"\n", invalid);
1894 goto cifs_parse_mount_err;
1895 }
1896
1882#ifndef CONFIG_KEYS 1897#ifndef CONFIG_KEYS
1883 /* Muliuser mounts require CONFIG_KEYS support */ 1898 /* Muliuser mounts require CONFIG_KEYS support */
1884 if (vol->multiuser) { 1899 if (vol->multiuser) {