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

Jeremy Allison jra at samba.org
Tue Jan 24 21:39:34 UTC 2023


On Wed, Jan 25, 2023 at 12:33:57AM +0300, Michael Tokarev wrote:
>>@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
>level.

Easiest fix is to just change the docs here :-).

>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.

Locking and share modes have bugger-all to do with leases and oplocks.

Please separate the two in your mind, things will make
much more sense when you do :-).

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

Because the local unix process *must* be blocked from
doing *anything* to the file until the SMB client has
flushed all changes back to the file.

inotify just notifies, it doesn't stop any local
client doing anything.



More information about the samba mailing list