cifsd-team / ksmbd

ksmbd kernel server(SMB/CIFS server)
151 stars 23 forks source link

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

Open tojoyccnu opened 8 months ago

tojoyccnu commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

@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 commented 8 months ago

@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 commented 8 months ago

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 commented 8 months ago

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

namjaejeon commented 8 months ago

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

tojoyccnu commented 7 months ago

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

namjaejeon commented 7 months ago

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