Hi Namjae, I looked through the interfaces used between userspace (ksmbd.mountd and ksmbd.control) and the kernel module. After loading the ksmbd.ko module and calling 'ksmbd.mountd', I see the following related proceses/kernel-threads: 12200 ? I 0:00 [kworker/0:0-ksmbd-io] 12247 ? Ss 0:00 ksmbd.mountd 12248 ? S 0:00 ksmbd.mountd 12249 ? S 0:00 [ksmbd-lo] 12250 ? S 0:00 [ksmbd-enp0s3] 12251 ? S 0:00 [ksmbd-enp0s8] 12252 ? S 0:00 [ksmbd-enp0s9] 12253 ? S 0:00 [ksmbd-enp0s10] 12254 ? I< 0:00 [ksmbd-smb_direc] 12255 ? S 0:00 [ksmbd:38794] 12257 ? S 0:00 [ksmbd:51579] I haven't found the exact place, but ksmbd.mountd starts the kernel-part. ksmbd.mountd also acts as some kind of upcall, for the server part, that takes care of authentication and some basic DCERPC calls. I'm wondering why there are two separate ways to kill the running server, 'killall ksmbd.mountd' for the userspace part and 'ksmbd.control -s' (which is just a wrapper for 'echo -n "hard" > /sys/class/ksmbd-control/kill_server') to shutdown the server part. As it's not useful to run any of these two components on its own, so I'm wondering why there's no stronger relationship. As naive admin I'd assume that the kernel part would detect the exit of ksmbd.mountd and shutdown itself. It would also be great to bind to specific ip addresses instead of devices and allow to run more than one instance of ksmbd.mountd (with different config files and or within containers). That's why I think single global hardcoded path like '/sys/class/ksmbd-control/kill_server' should be avoided, something like: '/sys/class/ksmbd-control/<pid-of-ksmbd.mountd>/kill_server' would be better (if it's needed at all). I also have ideas how ksmbd{.ok,.mountd} could make use of Samba's winbindd (or authentication) and Samba's rpc services, but this would require a few changes in the netlink protocol between ksmbd.ko and ksmbd.mountd. It would be great if a Samba smb.conf option could cause smbd to start ksmbd.mountd in the background and delegate all raw SMB handling to the kernel. So my main big question is how stable would the userspace interface to ksmbd.ko be treated? Would it be possible to change the netlink protocol or /sys/class/* behavior in future in order to improve things? Can we require that the userspace tool matches the kernel version for a while? I think iproute2 creates a version for each stable kernel tree and tools like bpftool, perf even come with each single kernel release. While others like 'cifs.upcall' try to work with any kernel version. What do others think? metze
Attachment:
signature.asc
Description: OpenPGP digital signature