Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ubuntu 22.04 (ksmbd v3.4.2) , mount.cifs is ok, but some simple file io ops are failed? #602

Open
tojoyccnu opened this issue Oct 31, 2023 · 10 comments

Comments

@tojoyccnu
Copy link

tojoyccnu commented Oct 31, 2023

Issue
See title, how can I get it correctly when using ksmbd. Just simple file ops would not be successful. ANY SUGGESTION or docs to follow。

Setup
linux version: ubuntu 22.04 kernel 5.15.0-87-generic
Version of kmod: ksmd ksmbd version : 3.4.2
Version of tools: git master

Expected behaviour
Files copy normally

I follow the ksmbs_tools 's step to share dictory, like below:
`
mkdir -vp $HOME/MyShare
sudo ksmbd.addshare --add
--option "path = $HOME/MyShare"
--option 'read only = no'
MyShare
sudo ksmbd.addshare --update MyShare

sudo ksmbd.adduser --add ubuntu

sudo ksmbd.addshare --update
--option "force user = $USER"
--option "force group = $USER"
MyShare
`

next, mount it normally.
sudo mount -o user=ubuntu //127.0.0.1/MyShare /mnt/smb
then, some file ops in the mountpoint /mnt/smb

sudo su root vim /mnt/smb/testfile01.txt // E667: Fsync failed echo "test" > /mnt/smb/testfile02.txt // no error occors, but file lenth is zero.

Why? How can I edit the ksmbd.conf, or update ksmbd version to newest version?

ksmbd.conf

`
[global]
; global parameters
bind interfaces only = no
deadtime = 0
guest account = nobody
ipc timeout = 0
map to guest = never
max active sessions = 1024
max connections = 128
max open files = 10000
netbios name = KSMBD SERVER
restrict anonymous = 0
server max protocol = SMB3_11
server min protocol = SMB2_10
server multi channel support = no
server signing = disabled
server string = SMB SERVER
share:fake_fscaps = 64
smb2 leases = no
smb2 max credits = 8192
smb2 max read = 4MB
smb2 max trans = 1MB
smb2 max write = 4MB
smb3 encryption = auto
smbd max io size = 8MB
tcp port = 445
workgroup = WORKGROUP
browseable = yes
create mask = 0744
crossmnt = yes
directory mask = 0755
force create mode = 0000
force directory mode = 0000
guest ok = no
hide dot files = yes
inherit owner = no
oplocks = yes

[public]
comment = share folder
browseable = yes
path = /home/ubuntu/MyShare
valid users = ubuntu
force user = ubuntu
public=yes
writeable=yes
available=yes

`

@namjaejeon
Copy link
Member

ksmbd in linux-5.15 kernel seems to be unstable. Please use ksmbd in the latest kernel(6.5 or 6.6) or use github ksmbd(https://github.com/cifsd-team/ksmbd). Let me know if you find same issue on the latest ones.

@tojoyccnu
Copy link
Author

tojoyccnu commented Nov 2, 2023

ksmbd in linux-5.15 kernel seems to be unstable. Please use ksmbd in the latest kernel(6.5 or 6.6) or use github ksmbd(https://github.com/cifsd-team/ksmbd). Let me know if you find same issue on the latest ones.

@namjaejeon It works now, thanks.
I will try to test it over RDMA, using MT27800 Family [ConnectX-5] Mellanox Technologies. Did you tested that before?

@namjaejeon
Copy link
Member

Did you tested that before?

@tojoyccnu I don't have all kinds of RDMA NICs. I have tested only ConnectX-3 Mellanox and a Chelsio NIC. There will not be some problem.

@namjaejeon
Copy link
Member

@tojoyccnu And you need to add "server multi channel support = yes" parameter in [global] section of ksmbd.conf. Without this, RDMA will not work with windows client.

@tojoyccnu
Copy link
Author

@namjaejeon Has the latest version of ksmbd (git master) been tested for compatibility with Linux kernel 6.6.0?

compile occors errors, like below:

./include/linux/fs.h:3016:43: note: expected ‘u32’ {aka ‘unsigned int’} but argument is of type ‘struct inode *’
3016 | void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *);
| ^~~
fs/smb/server/smb2pdu.c:5037:52: error: passing argument 3 of ‘generic_fillattr’ from incompatible pointer type [-Werror=incompatible-pointer-types]
5037 | generic_fillattr(file_mnt_idmap(fp->filp), inode, &stat);

fs/smb/server/smb2pdu.c: In function ‘find_file_posix_info’:
fs/smb/server/smb2pdu.c:5170:35: error: ‘struct inode’ has no member named ‘i_ctime’; did you mean ‘i_atime’?
5170 | time = ksmbd_UnixTimeToNT(inode->i_ctime);

...
and so on.

@tojoyccnu
Copy link
Author

Looks like the fix to this will be to use inode_get_ctime(i), and the appropriate setter function, for all of these places we have been accessing i->i_ctime directly。

linux 6.6.0 has changed arguments to function ‘generic_fillattr’.

@namjaejeon

@namjaejeon
Copy link
Member

@tojoyccnu Yes, there is a change in vfs. I will call you after updating it tonight or tomorrow.

@namjaejeon
Copy link
Member

@tojoyccnu Please check git clone https://github.com/namjaejeon/ksmbd

@tojoyccnu
Copy link
Author

@namjaejeon Is there a configuration to configure the number of cpu cores used?

@namjaejeon
Copy link
Member

@tojoyccnu No, there is no such configuration in ksmbd. nfs or samba has such options ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants