This temporary workaround works.
I want to add that on OpenWrt the user should edit the ksmbd config template and restart ksmbd in order to apply this workaround.
As you see in ksmbd github, I have shared the patch for this. If ptpt52 can apply this patch to openWRT as a temporary patch, users don't need to update configuration(oplock = no).
Yes I saw the patch.
Can I apply it if I redact a file/s or directly apply the patch before I compile the firmware.
I don't know how apply it to openWRT.
I saw how they apply a workaround patch before.
Hi, where I can find this patch? I can try to do that
Oh, Thank you for your help!
I can not find how attach the patch here..
So I have shared the link of patch.
I rush to warn that with option oplocks = no
trying to write to the share causes an immediate router reboot. I removed that from ksmbd.conf.
So we should implement the patch sooner.
Should be patched on kernel 6.1 and 5.15 right?
See the @linkinjeon post here.
Yes, It should be applied to both 5.15 and 6.1 kernel of openWRT.
Yesterday openwrt team tell me that was not good commit message, I think is ok now.
I'm sorry I'm newbie
Done from @ptpt52 (Thanks!)
Really thanks for your help! and Nice work!
@linkinjeon
Compiled with above PR and everything is OK for now with kernel 6.1.71.
I closed the issue.
Still while the topic is hot I want to ask one more thing.
Read speed from SSD USB3 Sandisk Extreme is only 60-70 MB/s (writing is at ~120 MBps). The SSD is capable of reading/writing speeds above 1000 MB/s.
Here are the posts reporting same lower read speed no matter samba or ksmbd is used.
Obviously this is not ksmbd specific fault but do you know anyone who can help with this.
Maybe I should open a new issue on OpemWrt.
You need to check network speed on your target. It can be the bottleneck, not disk speed.
Please refer this issue. It is similar case.
Last I looked at ksmbd-tools, I noticed there's custom handling of smb.conf files: https://github.com/openwrt/packages/blob/master/net/ksmbd-tools/files/ksmbd.init
I assume this predates the availability of addshare, adduser, etc...
Should this be changed?
Yeah, run into this just few days ago after updating my router with a newly built trunk image (the previous one I used was built maybe around a year before), and was quite surprised indeed if not to say more. I had oplocks = no
in one of my configured shares for years, and it never was an issue - at least it never crashed the whole device! Tried to google for openwrt-related ksmbd crashes and the only place I found was this exact reply of yours. Removing oplocks line from config helped, so thank you for mentioning it.
And still, why oplocks = no
is now crashing/rebooting openwrt?
Hi guys.
On some newer platforms (ipq807x, MT7986) we see lower reading / writing speeds than what we should expect on those powerful hardware SoCs.
Observations start from this post and several others after it.
Currently @pesa1234 suggested a solution here that is reported to work.
I've commented out the 3 lines in ksmbd.conf.template
as suggested in his post and now I get 112 MB/s read (almost doble speed than before) and ~100 MB/s writes (a small decrease here from 112 MB/s) over 1Gbps LAN port with ksmbd
and only a mere 10-15% CPU load on NSS-wifi build.
Client is Windows 11 PC.
@linkinjeon @neheb @pesa1234 @Lucky1
Any thoughts on this. Can default settings be further optimized / tuned for those platforms so the maximum read / write speeds are achievable from start without any user intervention.
smb2 max read/write/trans = 64K is not the default value of ksmbd. The default size for windows and ksmbd is 4MB. As far as I know, the reason why the default 64K was set is that the RAM size of the openWRT device was very small, so it was set to the smallest buffer size. I am curious as to whether the RAM of the device where openWRT can be currently installed is larger than before. And it seems that openWRT can automatically adjust and set the value according to the device RAM size.
For example,
32 ~ 64MB RAM, set the value to 64K,
64 ~ 128MB, set it to 128KB,
128 ~ 256MB, set it to 1MB,
and do not set any more, so it operates at the default 4MB.
Thanks for the info. That explains a lot.
So commenting out those lines actually set the default value of 4MB, right?
My QNAP IPQ807x OpenWrt router has 1024MB RAM.
Yes. See man ksmbd.conf manpage
smb2 max read (G)
Maximum length that may be used in a SMB2 READ request sent by a client. Number
suffixes are allowed.
Default: smb2 max read = 4MB
smb2 max trans (G)
Maximum buffer size that may be used by a client in a sent SET_INFO request or a
received QUERY_INFO, QUERY_DIRECTORY, or CHANGE_NOTIFY response. Number suffixes
are allowed.
Default: smb2 max trans = 1MB
smb2 max write (G)
Maximum length that may be used in a SMB2 WRITE request sent by a client. Number
suffixes are allowed.
Default: smb2 max write = 4MB
in case of smb2 max trans, it set 1MB by default. windows clients and linux client want to set read/write 4MB size in negotiation stage. If you want maximum performance, I would recommend to comment the parameters and set ksmbd to default (read/write 4MB, trans 1MB). However, I don't know how much memory the maximum consumes in an app scenario running, even if your device has 1GB size of RAM. If your app scenario uses almost 1GB of memory, You may need to adjust the smb2 max read/write size.