2021-04-28 5:53 GMT+09:00, J. Bruce Fields <bfields@xxxxxxxxxxxx>: > On Thu, Apr 22, 2021 at 09:28:14AM +0900, Namjae Jeon wrote: >> This is the patch series for cifsd(ksmbd) kernel server. >> >> What is cifsd(ksmbd) ? >> ====================== >> >> The SMB family of protocols is the most widely deployed >> network filesystem protocol, the default on Windows and Macs (and even >> on many phones and tablets), with clients and servers on all major >> operating systems, but lacked a kernel server for Linux. For many >> cases the current userspace server choices were suboptimal >> either due to memory footprint, performance or difficulty integrating >> well with advanced Linux features. >> >> ksmbd is a new kernel module which implements the server-side of the SMB3 >> protocol. >> The target is to provide optimized performance, GPLv2 SMB server, better >> lease handling (distributed caching). The bigger goal is to add new >> features more rapidly (e.g. RDMA aka "smbdirect", and recent encryption >> and signing improvements to the protocol) which are easier to develop >> on a smaller, more tightly optimized kernel server than for example >> in Samba. The Samba project is much broader in scope (tools, security >> services, >> LDAP, Active Directory Domain Controller, and a cross platform file >> server >> for a wider variety of purposes) but the user space file server portion >> of Samba has proved hard to optimize for some Linux workloads, including >> for smaller devices. This is not meant to replace Samba, but rather be >> an extension to allow better optimizing for Linux, and will continue to >> integrate well with Samba user space tools and libraries where >> appropriate. >> Working with the Samba team we have already made sure that the >> configuration >> files and xattrs are in a compatible format between the kernel and >> user space server. >> >> >> Architecture >> ============ >> >> |--- ... >> --------|--- ksmbd/3 - Client 3 >> |-------|--- ksmbd/2 - Client 2 >> | | >> ____________________________________________________ >> | | |- Client 1 >> | >> <--- Socket ---|--- ksmbd/1 <<= Authentication : NTLM/NTLM2, Kerberos >> | >> | | | | <<= SMB engine : SMB2, SMB2.1, SMB3, >> SMB3.0.2, | >> | | | | SMB3.1.1 >> | >> | | | >> |____________________________________________________| >> | | | >> | | |--- VFS --- Local Filesystem >> | | >> KERNEL |--- ksmbd/0(forker kthread) >> ---------------||--------------------------------------------------------------- >> USER || >> || communication using NETLINK >> || ______________________________________________ >> || | | >> ksmbd.mountd <<= DCE/RPC(srvsvc, wkssvc, samr, lsarpc) | >> ^ | <<= configure shares setting, user accounts | >> | |______________________________________________| >> | >> |------ smb.conf(config file) >> | >> |------ ksmbdpwd.db(user account/password file) >> ^ >> ksmbd.adduser ---------------| >> >> The subset of performance related operations(open/read/write/close etc.) >> belong >> in kernelspace(ksmbd) and the other subset which belong to >> operations(DCE/RPC, >> user account/share database) which are not really related with performance >> are >> handled in userspace(ksmbd.mountd). >> >> When the ksmbd.mountd is started, It starts up a forker thread at >> initialization >> time and opens a dedicated port 445 for listening to SMB requests. >> Whenever new >> clients make request, Forker thread will accept the client connection and >> fork >> a new thread for dedicated communication channel between the client and >> the server. > > Judging from the diagram above, all those threads are kernel threads, is > that right? So a kernel thread gets each call first, then uses netlink > to get help from ksmbd.mountd if necessary, is that right? Yes, That's right. > > --b. >