Skip to content

Commit d0d6ab5

Browse files
committed
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs version warning fix from Steve French: "As requested, additional kernel warning messages to clarify the default dialect changes" [ There is still some discussion about exactly which version should be the new default. Longer-term we have auto-negotiation coming, but that's not there yet.. - Linus ] * 'for-next' of git://git.samba.org/sfrench/cifs-2.6: Fix warning messages when mounting to older servers
2 parents 54f70f5 + 7e682f7 commit d0d6ab5

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

fs/cifs/connect.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
12231223
char *tmp_end, *value;
12241224
char delim;
12251225
bool got_ip = false;
1226+
bool got_version = false;
12261227
unsigned short port = 0;
12271228
struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr;
12281229

@@ -1874,24 +1875,35 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
18741875
pr_warn("CIFS: server netbiosname longer than 15 truncated.\n");
18751876
break;
18761877
case Opt_ver:
1878+
/* version of mount userspace tools, not dialect */
18771879
string = match_strdup(args);
18781880
if (string == NULL)
18791881
goto out_nomem;
18801882

1883+
/* If interface changes in mount.cifs bump to new ver */
18811884
if (strncasecmp(string, "1", 1) == 0) {
1885+
if (strlen(string) > 1) {
1886+
pr_warn("Bad mount helper ver=%s. Did "
1887+
"you want SMB1 (CIFS) dialect "
1888+
"and mean to type vers=1.0 "
1889+
"instead?\n", string);
1890+
goto cifs_parse_mount_err;
1891+
}
18821892
/* This is the default */
18831893
break;
18841894
}
18851895
/* For all other value, error */
1886-
pr_warn("CIFS: Invalid version specified\n");
1896+
pr_warn("CIFS: Invalid mount helper version specified\n");
18871897
goto cifs_parse_mount_err;
18881898
case Opt_vers:
1899+
/* protocol version (dialect) */
18891900
string = match_strdup(args);
18901901
if (string == NULL)
18911902
goto out_nomem;
18921903

18931904
if (cifs_parse_smb_version(string, vol) != 0)
18941905
goto cifs_parse_mount_err;
1906+
got_version = true;
18951907
break;
18961908
case Opt_sec:
18971909
string = match_strdup(args);
@@ -1973,6 +1985,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
19731985
else if (override_gid == 1)
19741986
pr_notice("CIFS: ignoring forcegid mount option specified with no gid= option.\n");
19751987

1988+
if (got_version == false)
1989+
pr_warn("No dialect specified on mount. Default has changed to "
1990+
"a more secure dialect, SMB3 (vers=3.0), from CIFS "
1991+
"(SMB1). To use the less secure SMB1 dialect to access "
1992+
"old servers which do not support SMB3 specify vers=1.0"
1993+
" on mount. For somewhat newer servers such as Windows "
1994+
"7 try vers=2.1.\n");
1995+
19761996
kfree(mountdata_copy);
19771997
return 0;
19781998

fs/cifs/smb2pdu.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,12 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
514514
* No tcon so can't do
515515
* cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);
516516
*/
517-
if (rc != 0)
517+
if (rc == -EOPNOTSUPP) {
518+
cifs_dbg(VFS, "Dialect not supported by server. Consider "
519+
"specifying vers=1.0 or vers=2.1 on mount for accessing"
520+
" older servers\n");
521+
goto neg_exit;
522+
} else if (rc != 0)
518523
goto neg_exit;
519524

520525
cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode);

0 commit comments

Comments
 (0)