diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/connect.c | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e0b56d7a19c5..4898759d97cc 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -102,7 +102,7 @@ enum { | |||
102 | Opt_srcaddr, Opt_prefixpath, | 102 | Opt_srcaddr, Opt_prefixpath, |
103 | Opt_iocharset, Opt_sockopt, | 103 | Opt_iocharset, Opt_sockopt, |
104 | Opt_netbiosname, Opt_servern, | 104 | Opt_netbiosname, Opt_servern, |
105 | Opt_ver, Opt_sec, | 105 | Opt_ver, Opt_sec, Opt_cache, |
106 | 106 | ||
107 | /* Mount options to be ignored */ | 107 | /* Mount options to be ignored */ |
108 | Opt_ignore, | 108 | Opt_ignore, |
@@ -213,6 +213,7 @@ static const match_table_t cifs_mount_option_tokens = { | |||
213 | { Opt_ver, "vers=%s" }, | 213 | { Opt_ver, "vers=%s" }, |
214 | { Opt_ver, "version=%s" }, | 214 | { Opt_ver, "version=%s" }, |
215 | { Opt_sec, "sec=%s" }, | 215 | { Opt_sec, "sec=%s" }, |
216 | { Opt_cache, "cache=%s" }, | ||
216 | 217 | ||
217 | { Opt_ignore, "cred" }, | 218 | { Opt_ignore, "cred" }, |
218 | { Opt_ignore, "credentials" }, | 219 | { Opt_ignore, "credentials" }, |
@@ -261,6 +262,21 @@ static const match_table_t cifs_secflavor_tokens = { | |||
261 | { Opt_sec_err, NULL } | 262 | { Opt_sec_err, NULL } |
262 | }; | 263 | }; |
263 | 264 | ||
265 | /* cache flavors */ | ||
266 | enum { | ||
267 | Opt_cache_loose, | ||
268 | Opt_cache_strict, | ||
269 | Opt_cache_none, | ||
270 | Opt_cache_err | ||
271 | }; | ||
272 | |||
273 | static const match_table_t cifs_cacheflavor_tokens = { | ||
274 | { Opt_cache_loose, "loose" }, | ||
275 | { Opt_cache_strict, "strict" }, | ||
276 | { Opt_cache_none, "none" }, | ||
277 | { Opt_cache_err, NULL } | ||
278 | }; | ||
279 | |||
264 | static int ip_connect(struct TCP_Server_Info *server); | 280 | static int ip_connect(struct TCP_Server_Info *server); |
265 | static int generic_ip_connect(struct TCP_Server_Info *server); | 281 | static int generic_ip_connect(struct TCP_Server_Info *server); |
266 | static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink); | 282 | static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink); |
@@ -1186,6 +1202,31 @@ static int cifs_parse_security_flavors(char *value, | |||
1186 | } | 1202 | } |
1187 | 1203 | ||
1188 | static int | 1204 | static int |
1205 | cifs_parse_cache_flavor(char *value, struct smb_vol *vol) | ||
1206 | { | ||
1207 | substring_t args[MAX_OPT_ARGS]; | ||
1208 | |||
1209 | switch (match_token(value, cifs_cacheflavor_tokens, args)) { | ||
1210 | case Opt_cache_loose: | ||
1211 | vol->direct_io = false; | ||
1212 | vol->strict_io = false; | ||
1213 | break; | ||
1214 | case Opt_cache_strict: | ||
1215 | vol->direct_io = false; | ||
1216 | vol->strict_io = true; | ||
1217 | break; | ||
1218 | case Opt_cache_none: | ||
1219 | vol->direct_io = true; | ||
1220 | vol->strict_io = false; | ||
1221 | break; | ||
1222 | default: | ||
1223 | cERROR(1, "bad cache= option: %s", value); | ||
1224 | return 1; | ||
1225 | } | ||
1226 | return 0; | ||
1227 | } | ||
1228 | |||
1229 | static int | ||
1189 | cifs_parse_mount_options(const char *mountdata, const char *devname, | 1230 | cifs_parse_mount_options(const char *mountdata, const char *devname, |
1190 | struct smb_vol *vol) | 1231 | struct smb_vol *vol) |
1191 | { | 1232 | { |
@@ -1414,10 +1455,12 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1414 | vol->seal = 1; | 1455 | vol->seal = 1; |
1415 | break; | 1456 | break; |
1416 | case Opt_direct: | 1457 | case Opt_direct: |
1417 | vol->direct_io = 1; | 1458 | vol->direct_io = true; |
1459 | vol->strict_io = false; | ||
1418 | break; | 1460 | break; |
1419 | case Opt_strictcache: | 1461 | case Opt_strictcache: |
1420 | vol->strict_io = 1; | 1462 | vol->direct_io = false; |
1463 | vol->strict_io = true; | ||
1421 | break; | 1464 | break; |
1422 | case Opt_noac: | 1465 | case Opt_noac: |
1423 | printk(KERN_WARNING "CIFS: Mount option noac not " | 1466 | printk(KERN_WARNING "CIFS: Mount option noac not " |
@@ -1838,6 +1881,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1838 | if (cifs_parse_security_flavors(string, vol) != 0) | 1881 | if (cifs_parse_security_flavors(string, vol) != 0) |
1839 | goto cifs_parse_mount_err; | 1882 | goto cifs_parse_mount_err; |
1840 | break; | 1883 | break; |
1884 | case Opt_cache: | ||
1885 | string = match_strdup(args); | ||
1886 | if (string == NULL) | ||
1887 | goto out_nomem; | ||
1888 | |||
1889 | if (cifs_parse_cache_flavor(string, vol) != 0) | ||
1890 | goto cifs_parse_mount_err; | ||
1891 | break; | ||
1841 | default: | 1892 | default: |
1842 | /* | 1893 | /* |
1843 | * An option we don't recognize. Save it off for later | 1894 | * An option we don't recognize. Save it off for later |