]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Introduce smb2 mounts as vers=2
authorSteve French <sfrench@us.ibm.com>
Thu, 24 Feb 2011 18:07:19 +0000 (18:07 +0000)
committerSteve French <sfrench@us.ibm.com>
Thu, 19 May 2011 14:10:50 +0000 (14:10 +0000)
As with Linux nfs client, which uses "nfsvers=" or "vers=" to
indicate which protocol to use for mount, specifying

"vers=smb2" or "vers=2"

will force an smb2 mount. When vers is not specified cifs is used

ie "vers=cifs" or "vers=1"

We can eventually autonegotiate down from smb2 to cifs
when smb2 is stable enough to make it the default, but this
is for the future.  At that time we could also implement a
"maxprotocol" mount option as smbclient and Samba have today,
but that would be premature until smb2 is stable.

Intially the smb2 Kconfig option will depend on "BROKEN"
until the merge is complete, and then be "EXPERIMENTAL"
When it is no longer experimental we can consider changing
the default protocol to attempt first.

Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/connect.c

index 8d72acbd5c1328a7f8ad0ce9636b996cf35165d5..acd1e3c887e1e1e9f6bba6dfd188631c8e0c7979 100644 (file)
@@ -102,6 +102,7 @@ struct smb_vol {
        bool fsc:1;     /* enable fscache */
        bool mfsymlinks:1; /* use Minshall+French Symlinks */
        bool multiuser:1;
+       bool use_smb2:1; /* force smb2 use on mount instead of cifs */
        unsigned int rsize;
        unsigned int wsize;
        bool sockopt_tcp_nodelay:1;
@@ -1038,6 +1039,22 @@ cifs_parse_mount_options(char *options, const char *devname,
                                cERROR(1, "bad security option: %s", value);
                                return 1;
                        }
+               } else if (strnicmp(data, "vers", 3) == 0) {
+                       if (!value || !*value) {
+                               cERROR(1, "no protocol version specified"
+                                         " after vers= mount option");
+                       } else if ((strnicmp(value, "cifs", 4) == 0) ||
+                                  (strnicmp(value, "1", 1) == 0)) {
+                               /* this is the default */
+                               continue;
+                       } else if ((strnicmp(value, "smb2", 4) == 0) ||
+                                  (strnicmp(value, "2", 1) == 0)) {
+#ifdef CONFIG_CIFS_SMB2
+                               vol->use_smb2 = true;
+#else
+                               cERROR(1, "smb2 support not enabled");
+#endif /* CONFIG_CIFS_SMB2 */
+                       }
                } else if ((strnicmp(data, "unc", 3) == 0)
                           || (strnicmp(data, "target", 6) == 0)
                           || (strnicmp(data, "path", 4) == 0)) {