Bug 14521 - CIFS mount shows only "vers=default" instead of specific SMB version
Summary: CIFS mount shows only "vers=default" instead of specific SMB version
Status: NEW
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 4.x
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Steve French
QA Contact: cifs QA contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-05 17:31 UTC by kolAflash
Modified: 2020-10-06 09:01 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kolAflash 2020-10-05 17:31:31 UTC
/proc/mounts and the mount command don't show the auto negotiated version after mounting with vers=default (or without specifying vers=).
Instead /proc/mounts just says vers=default.
Client OS: openSUSE-LEAP-15.2 with Linux-5.3

This non-public bug seems to be similar.
(I don't habe a RedHat license, so I can't see the details)
https://access.redhat.com/solutions/4592681

I was only able to reproduce with Windows Server 2012.
A Windows Server 2008 and Samba-4.6 (openSUSE-LEAP-42.3) work fine.
(e.g. /proc/mounts shows vers=3.11)


Workaround with some help from:
https://wiki.samba.org/index.php/LinuxCIFS_troubleshooting

echo 'module cifs +p' > /sys/kernel/debug/dynamic_debug/control
echo 'file fs/cifs/* +p' > /sys/kernel/debug/dynamic_debug/control
echo 7 > /proc/fs/cifs/cifsFYI
mount -t cifs ...
dmesg | grep -E 'cifs.*[123]\.[0-9]'
# -> negotiated smb3.02 dialect

So for me it's actually 3.02 what's been negotiated with Windows Server 2012.


P.S.
"man mount.cifs" may seem a little ambiguous about the vers=default behavior.
Quote:
==========
SMB protocol version. Allowed values are:
[...]
  - default - Tries to negotiate the highest SMB2+ version supported by both the client and server.
[...]
  The default since v4.13.5 is for the client and server to negotiate
  the highest possible version greater than or equal to ``2.1``. In
  kernels prior to v4.13, the default was ``1.0``. For kernels
  between v4.13 and v4.13.5 the default is ``3.0``.
==========
The first one sound more like 2.0 <= vers < 3.0.
While the second sounds more like 2.1 <= version (without upper limit).
To me it looks like the second (2.1 <= version) is what's actually implemented (at least with Linux-5.3 on openSUSE-LEAP-15.2).
Comment 1 Aurélien Aptel 2020-10-06 09:01:26 UTC
Just to make sure I get this right:

With the same version of the kernel (openSUSE-LEAP-15.2 with Linux-5.3), when you mount with vers=default:
- a Windows Server 2012 share you see vers=3.11 in /proc/mounts
- anything else you see vers=default in /proc/mounts

And you are expecting the see the explicit version instead of default. Is that right?


As a side note, if you just need to version you can look at /proc/fs/cifs/DebugData. It will list all currently active connections along with their version as "Dialect":

    # mount.cifs //foo/bar ....
    # grep Dialect /proc/fs/cifs/DebugData 
    Number of credits: 407 Dialect 0x311 signed

=> 0x311 is 3.1.1