This seems much isolated to your specific setup, file locks (oplocks) can be tuned in smb.conf however since the defaults are used in most setups without issues you have to understand that there will not be tuning in favor of your setup specifically if you have clients crashing which isn't normal behaviour.
Whatever performance issue you have with wifi is clearly outside the scope of Samba.
I would try to first replicate this using files on /var /tmp, so we can exclude storage device or filesystem specific problems. So you can try share /var aka ramfs and see how access and locking behaves on it.
If it behaves the same, we can at least assume its not filesystem, storage driver specific.
Than i would try different smb versions v1, v2, v3 and verify the connections via a Windows 10 client and powershell (Get-SmbConnection).
I would also probably compare samba3 and cifsd speeds, just to see if its a wifi + samba4 problem or also happens on other services, maybe even nfsv4 if i'm desperate.
The main goal is to find out, if you need to fiddle with wifi or filesharing services settings.
I found that /etc/init.d/samba4 parses only few parameters of config file.
For example:
I try to create shared folder with full acces for authenticated users, and for guests - with read only acces.
In /etc/config/samba4 I wrote:
After 'service samba4 restart' I didn't find string write list = User in temporary config file.
To solve this problem I added next string in /etc/init.d/samba4
I made some investigation at weekend, better now, here are the results:
File locks. In fact, it was quite stable from one of the operation by software on host, so easy to diagnose. Result - fully disabling oplocks fix it.
Netbios "master browser" spam in logs (can't promote) - quite common-style bug. In my configuration, i have different names for netbios and DNS. So, the issue then promote to master browser, nmbd trying to promote to master DNS name instead of Netbios one - and can't find it! Bug. Fix it for now setting the same name for netbios and DNS.
Wifi read speed degradation. Seems like it's both Samba and wifi protocol bug. As i expect, the issue related to different package fragmentation between ethernet and wifi. So, then i remove "max xmit" parameter or set it to below 2310 - situation becomes better. Did Samba have frame size at network interface in mind?
Let me check - i bet i will have performance degradation on wired if enable jumbo frames as well.
For now i have interesting result - i have reasonable speed first 1-3 secs, then it drops about 40%. Anyway, this is 15% better, then before.
PS: I can't alter "server max protocol" - if i set it lower, then default SMB3, i can't browse and connect shares. Maybe it's my windows config, but, in fact, i have SMB1 support installed there. Let me check as well.
ehi @Andy2244 i discoverd something interesting...
i find out why my samba share didn't work...
i use unbound as my dns server so i tought that unbound was the problem... Well today i tried my andoird phone and i notice that i does discover the samaba share but I notice one specific problem.
The hostname of my router is "No-More-Lag-Router"
But on the andoird device it was seen as "NO-MORE-LAG-ROU"
This could be a problem with the app... but let's try it... I changed the hostname to "NoLag-Router" and my samba share started to work right away...
This is stupid as...
the error reported is this
Sun May 19 13:15:34 2019 daemon.err nmbd[8305]: [2019/05/19 13:15:34.368159, 0] ../source3/nmbd/nmbd_become_lmb.c:533(become_local_master_browser)
Sun May 19 13:15:34 2019 daemon.err nmbd[8305]: become_local_master_browser: Error - cannot find server NO-MORE-LAG-ROUTER in workgroup WORKGROUP on subnet 192.168.2.1
But the real problem is with the name lenght... Think something is broken on samba source or is a limitation of the broadcast service.
We enable mdns name by default, maybe there is a problem?
## Allows the server name that is advertised through MDNS to be set to the hostname rather than the Samba NETBIOS name.
## This allows an administrator to make Samba registered MDNS records match the case of the hostname rather than being in all capitals.
## (netbios, mdns)
mdns name = mdns
@Ansuel it may have been Unbound. Samba 4 uses mdns (rfc6762) and that must use TLD "local." Unbound scripts put that in s dead end SOA record to prevent DNS leaks from dumb clients. Avahi will terminate if it sees that SOA. Avahi sees it is an admin domain, and not adhoc as the RFC requires. Openwrt-18.06 packages fixed this and "local." Is forced to be NXDOMAIN instead.
Although samba-tool is built, when you try and run it, "import ldb" fails because ldb.so is not built. Not sure if there's other dependencies after that, but for sure the python ldb.so is missing. I compared this to what it looks like under Ubuntu, and there should be an ldb.so in /usr/lib/python2.7/dist-packages/ldb.so