Bug 213927 - CIFS: can't create file or directory when mount with modefromsid
Summary: CIFS: can't create file or directory when mount with modefromsid
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: CIFS (show other bugs)
Hardware: All Linux
: P1 high
Assignee: fs_cifs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-30 07:45 UTC by Xiaoli Feng
Modified: 2021-08-04 14:48 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.14.0-rc2
Subsystem:
Regression: No
Bisected commit-id:


Attachments
network trace (15.67 KB, application/vnd.tcpdump.pcap)
2021-07-30 07:45 UTC, Xiaoli Feng
Details
dmesg log (24.95 KB, text/plain)
2021-07-30 07:46 UTC, Xiaoli Feng
Details

Description Xiaoli Feng 2021-07-30 07:45:57 UTC
Created attachment 298125 [details]
network trace

Mount windows server 2012 file server on linux 5.14.0 with modefromsid. I can't  create file or directory in this mountpoint. Can do these operations without modefromsid. This is a regression issue after switch to new mount API.


# mount //$WIN_SERVER/cifs cifs -o modefromsid,user=administrator,password=$WINPASSWD
# touch cifs/file
touch: setting times of 'cifs/file': No such file or directory
# mkdir cifs/dira
mkdir: cannot create directory ‘cifs/dira’: Invalid argument
# uname -r
5.14.0-rc2+
Comment 1 Xiaoli Feng 2021-07-30 07:46:27 UTC
Created attachment 298127 [details]
dmesg log
Comment 2 Xiaoli Feng 2021-07-30 09:11:15 UTC
samba server also has this issue.

# mount //localhost/cifs cifs -o modefromsid,user=root,password=redhat
# touch cifs/file
touch: setting times of 'cifs/file': No such file or directory
# mkdir cifs/dir
mkdir: cannot create directory ‘cifs/dir’: Invalid argument
# cat /etc/samba/smb.conf
[cifs]
path=/mnt/cifs
writeable=yes
Comment 3 Shyam Prasad N 2021-08-03 04:40:13 UTC
Can you try using idsfromsid in combination with modefromsid?
(This should probably be set implicitly. I'll submit that change soon)

sprasad@lindev-local:/mnt/windows$ mount -t cifs
//192.168.10.1/Shared on /mnt/windows type cifs (rw,relatime,vers=3.1.1,cache=strict,username=sprasad,uid=1000,noforceuid,gid=1000,noforcegid,addr=192.168.10.1,file_mode=0777,dir_mode=0777,soft,nounix,idsfromsid,serverino,mapposix,modefromsid,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)
sprasad@lindev-local:/mnt/windows$ mkdir cifstest
sprasad@lindev-local:/mnt/windows$
Comment 4 Steve French 2021-08-04 14:30:15 UTC
This is not related to the mount API change (the regression also happens in 5.10 kernel e.g.) and is due instead to the server not accepting using the "default" user and group (when the user and group SID is not specified) on create with SecurityDescriptor - this change to allow the mode to be specified on create was made earlier than 5.10 kernel.
Comment 5 Steve French 2021-08-04 14:48:30 UTC
It works in 5.9 but fails in 5.10.  The main difference I see is the length of the security descriptor context is smaller in 5.10 and later (180 bytes SD context blob length worked vs. 76 bytes in SD fails with invalid parameter)

Note You need to log in before you can comment on or make changes to this bug.