Features
Implemented
* SMB1(CIFS), SMB2/3 protocols for basic file sharing * Compound requests * oplock/lease * Large MTU(Multi-credit) * NTLM/Planned
* Durable handle and v2 * Persistent handles * Cluster Support * SCSI over SMB3Architecture
The subset of performance related operations belong in kernelspace and the other subset which belong to operations which are not really related with performance in userspace. So,ksmbd (kernel daemon)
When the server daemon is started, it starts up a forker thread (ksmbd/0) at initialization time and opens a dedicated port 445 for listening to SMB requests. Whenever new clients make requests, the forker thread will accept the client connection and fork a new thread for a dedicated communication channel between the client and the server. It allows for parallel processing of SMB requests (commands) from clients as well as allowing for new clients to make new connections. Each instance is named ksmbd/1~n to indicate connected clients. Depending on the SMB request types, each new thread can decide to pass through the commands to the user space (ksmbd.mountd). Currently DCE/RPC commands are identified to be handled through the user space. To further utilize the linux kernel, it has been chosen to process the commands as default workitems to be executed in the handlers of the default kworker threads. It allows for multiplexing of the handlers as the kernel take care of initiating extra worker threads if the load is increased and vice versa, if the load is decreased it destroys the extra worker threads. So, after connection is established with the client, a dedicated ksmbd task takes complete ownership of the receiving and parsing of SMB commands. Each of the multiple clients' commands received is worked in parallel. After receiving each command a separated kernel workitem is prepared for each command which is further queued to be handled by default kworker'threads inside the kernel. So, each SMB workitem is queued to the kworkers. This allows the benefit of load sharing to be managed optimally by the default kernel and optimizes client performance by handling client commands in parallel.ksmbd.mountd (user space daemon)
ksmbd.mountd is userspace process to, transfer user account and password that are registered using ksmbd.adduser (part of utils for user space). Further it allows sharing information parameters that parsed from smb.conf to smb export layer in kernel. For the execution part it has a daemon which is continuously running and connected to the kernel interface using netlink socket, it waits for the requests (dcerpc and winreg). It handles RPC calls (at a minimum few dozen) that are most important for file server from NetShareEnum and NetServerGetInfo and various DFS related calls which a server must implement. Complete DCE/RPC response is prepared from the user space and passed over to the associated kernel thread for the client.See also
* Comparison of operating system kernels * Server Message Block *References
* https://github.com/cifsd-team/ksmbd/blob/master/README.md * User Manual : https://github.com/namjaejeon/Documents/blob/master/CIFSD_User_Guide_v1.0.pdfExternal links
* * {{GitHub, cifsd-team/ksmbd-tools