]> git.ipfire.org Git - thirdparty/linux.git/commit
ksmbd: add procfs interface for runtime monitoring and statistics
authorBahubali B Gumaji <bahubali.bg@samsung.com>
Thu, 5 Feb 2026 00:08:35 +0000 (09:08 +0900)
committerSteve French <stfrench@microsoft.com>
Mon, 9 Feb 2026 02:25:16 +0000 (20:25 -0600)
commitb38f99c1217ae04753340f0fdcd8f35bf56841dc
tree5a39ac808516a7cf7049f4ca3c0cc495668f134a
parent010eb01ce23b34b50531448b0da391c7f05a72af
ksmbd: add procfs interface for runtime monitoring and statistics

This patch introduces a /proc filesystem interface to ksmbd, providing
visibility into the internal state of the SMB server. This allows
administrators and developers to monitor active connections, user
sessions, and opened files in real-time without relying on external
tools or heavy debugging.

Key changes include:
 - Connection Monitoring (/proc/fs/ksmbd/clients): Displays a list of
   active network connections, including client IP addresses, SMB dialects,
   credits, and last active timestamps.

 - Session Management (/proc/fs/ksmbd/sessions/): Adds a global sessions
   file to list all authenticated users and their session IDs.

 - Creates individual session entries (e.g., /proc/fs/ksmbd/sessions/<id>)
   detailing capabilities (DFS, Multi-channel, etc.), signing/encryption
   algorithms, and connected tree shares.

 - File Tracking (/proc/fs/ksmbd/files): Shows all currently opened files
   across the server, including tree IDs, process IDs (PID), access modes
   (daccess/saccess), and oplock/lease states.

 - Statistics & Counters: Implements internal counters for global server
   metrics, such as the number of tree connections, total sessions, and
   processed read/write bytes.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Bahubali B Gumaji <bahubali.bg@samsung.com>
Signed-off-by: Sang-Soo Lee <constant.lee@samsung.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
18 files changed:
fs/smb/server/Makefile
fs/smb/server/connection.c
fs/smb/server/connection.h
fs/smb/server/mgmt/tree_connect.c
fs/smb/server/mgmt/user_config.c
fs/smb/server/mgmt/user_config.h
fs/smb/server/mgmt/user_session.c
fs/smb/server/mgmt/user_session.h
fs/smb/server/misc.h
fs/smb/server/proc.c [new file with mode: 0644]
fs/smb/server/server.c
fs/smb/server/smb2ops.c
fs/smb/server/smb2pdu.c
fs/smb/server/smb_common.c
fs/smb/server/smb_common.h
fs/smb/server/stats.h [new file with mode: 0644]
fs/smb/server/vfs.c
fs/smb/server/vfs_cache.c