[Samba] oplocks, kernel oplocks, kernel share modes, .. - how it all works?

Michael Tokarev mjt at tls.msk.ru
Tue Jan 24 21:33:57 UTC 2023

25.01.2023 00:19, Ralph Boehme via samba пишет:
>> so setting "kernel oplocks = yes" should prevent SMB2_CAP_LEASING
>> being returned to the client. A wireshark trace when you remove
>> the "smb2 leases = no" line would be good to look at.
> oh! That is the only place where we treat kernel oplocks as a global option. The docs and the rest of the code allow this as a per share option. Looks 
> like we have a problem here.
> @Michael: move the kernel oplocks setting to the global section, then things may start to work as expected.

With kernel oplocks = yes in [global] but without mentioning
smb2 leases, this thing behaves in a way similar to when setting
smb2 leases to no (also globally, as it is a global parameter), --
I see the original NONE/BATCH/LEVEL_II oplocks in there as in the
old good times.

So looks like Ralph is correct here. Effectively, kernel oplocks
turn smb2 leases off, and work on the global level, not on a share


It looks like this needs some more experiments on my side though,
I'm not sure if it actually works and the cache is being invalidated
properly.  Also from my own description of whole thing, it looks
like there's no way to do anything when the file is actually locked.

Why inotify can't be used instead of F_SETLEASE here?



More information about the samba mailing list