[OPEN] mount cifs behavior depending kernel version

Post Reply
Marot
Crewman
Posts: 5
Joined: Thu Mar 09, 2023 5:43 pm

Hi

I have a Network Attached Storage (NAS) and I'm mounting multiple network shares using script:
PASS=$(zenity --password) &&
sudo mount -t cifs -m -o noperm,noserverino,user=${USER},password=${PASS},vers=2.1,sec=ntlmssp //${IP}/Share1 /run/media/${USER}/NAS/Share1 &&
sudo mount -t cifs -m -o noperm,noserverino,user=${USER},password=${PASS},vers=2.1,sec=ntlmssp //${IP}/Share2 /run/media/${USER}/NAS/Share2 &&
sudo mount -t cifs -m -o noperm,noserverino,user=${USER},password=${PASS},vers=2.1,sec=ntlmssp //${IP}/Share3 /run/media/${USER}/NAS/Share3 &&
sudo mount -t cifs -m -o noperm,noserverino,user=${USER},password=${PASS},vers=2.1,sec=ntlmssp //${IP}/Share4 /run/media/${USER}/NAS/Share4 &&
sudo mount -t cifs -m -o noperm,noserverino,user=${USER},password=${PASS},vers=2.1,sec=ntlmssp //${IP}/Share5 /run/media/${USER}/NAS/Share5
It was working fine before, but currently the issue is that it mounts the same network share to each folder. It always mounts the first share mounted after boot so I reordered them to have most important one as the first one.

I checked dmesg for any issues when mounting. I already fixed all warnings by adding additional params you can see in the script above so currently the log contains just:
[  141.570491] CIFS: Attempting to mount \\${IP}\Share1
[  141.863082] CIFS: Attempting to mount \\${IP}\Share2
[  141.917773] CIFS: Attempting to mount \\${IP}\Share3
[  141.954368] CIFS: Attempting to mount \\${IP}\Share4
[  141.995645] CIFS: Attempting to mount \\${IP}\Share5
I tested LTS kernel and figured out that the behavior is dependent on kernel used.

When using 6.1.15-1-lts kernel, this script successfully mounts 5 different shares as expected.
With linux kernel 6.2.2 scripts execute without reported issues but mounts Share1 in all 5 folders.

I didn't find similar issue reported online yet. Can you tell me where should I ask this question or where to report this issue so it will be fixed? I'm starting with the forum of the distribution I use.
I think that if the script is working without any change on other kernel version, it's no longer an issue with some wrong parameters for the mount command.
User avatar
fennec
Crewman
Posts: 105
Joined: Wed Dec 28, 2022 9:54 pm
Location: UK
Contact:

Are you able to run those mount commands manually, and add the verbose -v flag ?
Then compare the messages you get from running the same commands within both kernels.

If this is indeed a bug within the kernel see the following on how to report a bug.
https://wiki.samba.org/index.php/Bug_Reporting
User avatar
fennec
Crewman
Posts: 105
Joined: Wed Dec 28, 2022 9:54 pm
Location: UK
Contact:

With the following test script with slight differences to one you posted.
I had no issues mounting shares on 6.1.15-1-lts and 6.2.2.arch1-1

Code: Select all

#!/usr/bin/env sh
NAS_IP=0.0.0.0
USER="some-user"
PASS=$(zenity --password) &&

sudo mount -v -t cifs -m -o noperm,noserverino,user="${USER}",password="${PASS}",vers=2.1,sec=ntlmssp //${NAS_IP}/shared1 /mnt/cifs/shared1 &&
sudo mount -v -t cifs -m -o noperm,noserverino,user="${USER}",password="${PASS}",vers=2.1,sec=ntlmssp //${NAS_IP}/shared2 /mnt/cifs/shared2 &&
sudo mount -v -t cifs -m -o noperm,noserverino,user="${USER}",password="${PASS}",vers=2.1,sec=ntlmssp //${NAS_IP}/shared3 /mnt/cifs/shared3 &&
sudo mount -v -t cifs -m -o noperm,noserverino,user="${USER}",password="${PASS}",vers=2.1,sec=ntlmssp //${NAS_IP}/shared4 /mnt/cifs/shared4 && 
sudo mount -v -t cifs -m -o noperm,noserverino,user="${USER}",password="${PASS}",vers=2.1,sec=ntlmssp //${NAS_IP}/shared5 /mnt/cifs/shared5 

The shared* directory's were all mounted correctly.
Was /run/media/${USER}/NAS/* empty before running the mount cmds ?
Marot
Crewman
Posts: 5
Joined: Thu Mar 09, 2023 5:43 pm

Hi!

Thanks for checking if it is working in your case. I added verbose flag. It prints
mount.cifs kernel mount options: ip=<IP>,unc=\\<IP>\Share1,noperm,noserverino,vers=2.1,sec=ntlmssp,user=${USER},pass=********
mount.cifs kernel mount options: ip=<IP>,unc=\\<IP>\Share2,noperm,noserverino,vers=2.1,sec=ntlmssp,user=${USER},pass=********
mount.cifs kernel mount options: ip=<IP>,unc=\\<IP>\Share3,noperm,noserverino,vers=2.1,sec=ntlmssp,user=${USER},pass=********
mount.cifs kernel mount options: ip=<IP>,unc=\\<IP>\Share4,noperm,noserverino,vers=2.1,sec=ntlmssp,user=${USER},pass=********
mount.cifs kernel mount options: ip=<IP>,unc=\\<IP>\Share5,noperm,noserverino,vers=2.1,sec=ntlmssp,user=${USER},pass=********
which is rather a successful output. Unfortunately on newest kernel all folders have the same Share1 mounted. I am not manually creating directories before mounting - they are created by mount command if not yet existing.
I tried creating them beforehand but it does not make a difference.
Marot
Crewman
Posts: 5
Joined: Thu Mar 09, 2023 5:43 pm

I created a log and dump file using script which was suggested in https://wiki.samba.org/index.php/Bug_Reporting
and compared trace.log.
Files look totally different on different kernels. In working - LTS - version it is just:
[ 69.160211] device enp6s0 entered promiscuous mode
[ 74.820648] FS-Cache: Loaded
[ 74.822722] Key type dns_resolver registered
[ 74.860555] Key type cifs.spnego registered
[ 74.860562] Key type cifs.idmap registered
[ 74.860895] CIFS: Attempting to mount \\${IP}\Share1
[ 75.164705] CIFS: Attempting to mount \\${IP}\Share2
[ 75.487232] CIFS: Attempting to mount \\${IP}\Share3
[ 75.842562] CIFS: Attempting to mount \\${IP}\Share4
[ 76.172424] CIFS: Attempting to mount \\${IP}\Share5
[ 79.507818] device enp6s0 left promiscuous mode
Log for the newest kernel has 660 lines. I found some with errors:
cat trace.log | grep error
[ 1866.033175] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000016 to POSIX err -5
[ 1866.155816] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000034 to POSIX err -2
[ 1866.156564] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000034 to POSIX err -2
[ 1866.159612] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000034 to POSIX err -2
[ 1866.159960] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000034 to POSIX err -2
[ 1866.160591] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000034 to POSIX err -2
[ 1866.160803] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0x80000006 to POSIX err -61
[ 1866.161922] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0x80000006 to POSIX err -61
[ 1866.162917] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0x80000006 to POSIX err -61
[ 1866.163805] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0x80000006 to POSIX err -61
I think I'll try to report this issue on Samba bugzilla kernel section.
User avatar
fennec
Crewman
Posts: 105
Joined: Wed Dec 28, 2022 9:54 pm
Location: UK
Contact:

https://learn.microsoft.com/en-us/opens ... d39e3762ea

Those status codes map to the ones shown in the link above.

0xc0000016 = STATUS_MORE_PROCESSING_REQUIRED # There is more data available to read on the designated named pipe.
0xc0000034 = STATUS_NO_SUCH_FILE # File not found.
0x80000006 = STATUS_NO_MORE_FILES # No (more) files found following a file search command.

It is strange you see those error messages on 6.2.2.arch1-1.
As 6.2.7.arch1-1 is now the latest available kernel are you seeing the same errors on there too?
Marot
Crewman
Posts: 5
Joined: Thu Mar 09, 2023 5:43 pm

It is working fine on LTS kernel 6.1.21-1-lts so probably all 6.1.x and not on latest kernel 6.2.x
Marot
Crewman
Posts: 5
Joined: Thu Mar 09, 2023 5:43 pm

Today I upgraded kernel to 6.2.8-ach1-1 and mounting my multiple NAS shares is working again as expected.

I can go back and switch from using LTS kernel to latest kernel again.
User avatar
erikdubois
Captain
Posts: 5568
Joined: Tue Nov 07, 2017 3:45 pm
Location: Belgium
Contact:

great

we have seen this happen with kernels in the past

users congratulating us for fixing 'it' and we did nothing

it is often in the kernels
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
then use the power of our moderators.
Post Reply

Return to “Kernel & Hardware”