ArticleslgStudy

computer science

KSMBD

KSMBD is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand KSMBD rather than just read about it. In short: KSMBD is an open-source in-kernel CIFS/SMB server created by Namjae Jeon for the Linux kernel. Initially the goal is to provide improved file I/O performance, but the bigger goal is to have some new features which are much easier to develop and maintain inside the kernel and expose the layers fully.

KSMBD — main illustration
KSMBD — illustration

Key takeaways

  • KSMBD belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect KSMBD to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of KSMBD from memory before moving on to harder problems.

Reference excerpt

KSMBD is an open-source in-kernel CIFS/SMB server created by Namjae Jeon for the Linux kernel. Initially the goal is to provide improved file I/O performance, but the bigger goal is to have some new features which are much easier to develop and maintain inside the kernel and expose the layers fully. Directions can be attributed to sections where Samba is moving to a few modules inside the kernel to have features like Remote direct memory access (RDMA) to work with actual performance gain.

Features

Implemented SMB1(CIFS), SMB2/3 protocols for basic file sharing Compound requests oplock/lease Large MTU(Multi-credit) NTLM/NTLMv2 Auto negotiation HMAC-SHA256 Signing Secure negotiate Signing Update Pre-authentication integrity(SMB 3.1.1, Windows 10) SMB encryption (CCM, GCM) SMB direct(RDMA) WinACL (Security descriptor) Kerberos Directory lease Multi-channel Durable handle and v2

Planned Persistent handles Cluster Support SCSI over SMB3

Architecture 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, DCE/RPC management that has historically resulted into number of buffer overflow issues and dangerous security bugs and winreg and user account management are implemented in user space as ksmbd.mountd. File operations that are related with performance (open/read/write/close etc.) are in kernel space (ksmbd). This also allows for easier integration with the VFS interface for all file operations.

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 work items 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 work item is prepared for each command which is further queued to be handled by default kworker threads inside the kernel. So, each SMB work item 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 List of products that support SMB

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.pdf

External links ksmbd on GitHub ksmbd-tools on GitHub INTRODUCE IN-KERNELSMB3 SERVER CALLED CIFSD, SambaXP 2019 (2019-06-05) INTRODUCE IN-KERNELSMB3 SERVER CALLED CIFSD, Storage Developer Conference 2019 (2019-09-23)

Worked examples

Example 1 — a first encounter with KSMBD

Start with the simplest possible case. Write down what KSMBD claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to KSMBD before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about KSMBD ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of KSMBD

In research
KSMBD appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses KSMBD in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
KSMBD is common in secondary-school and first-year university syllabi. It links to neighbouring topics File systems supported by the Linux kernel, Network file systems, so understanding it makes those chapters shorter.
In everyday life
Look for KSMBD outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “KSMBD” →

How to study KSMBD in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what KSMBD means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain KSMBD out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is KSMBD in simple terms?

KSMBD is an open-source in-kernel CIFS/SMB server created by Namjae Jeon for the Linux kernel. Initially the goal is to provide improved file I/O performance, but the bigger goal is to have some new features which are much easier to develop and maintain inside the kernel and expose the layers fully.

Why does KSMBD matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study KSMBD?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on KSMBD.

Tags

  • File systems supported by the Linux kernel
  • Network file systems

Keep exploring