Jeremy Allison
2023-Jan-24 21:43 UTC
[Samba] oplocks, kernel oplocks, kernel share modes, .. - how it all works?
On Tue, Jan 24, 2023 at 01:39:34PM -0800, Jeremy Allison via samba wrote:> >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 :-).Actually, separate the three :-). Locking: Byte-ranges that control access to *parts* of a file. Mandatory on Windows, advisory on Linux. Samba maps Mandatory Windows byte-range locks to advisory locks on Linux so it works smbd -> smbd, but not if local processes ignore the locks (they are advisory on Linux). Share modes: Controls on how a file may be opened simultaneously. Windows-only, no analogue in Linux at all. Leases and Oplocks: Windows only (although NFSv4 has leases also). Controls client side caching of file data. No analogue in local processes on Linux.
Michael Tokarev
2023-Jan-24 21:58 UTC
[Samba] oplocks, kernel oplocks, kernel share modes, .. - how it all works?
25.01.2023 00:43, Jeremy Allison via samba wrote:> On Tue, Jan 24, 2023 at 01:39:34PM -0800, Jeremy Allison via samba wrote: >> >> 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 :-). > > Actually, separate the three :-).Yes. I know the concepts, I understand quite well how they works. I wrote a wiki page about it yesterday. They're definitely separate in my mind :) What I mean is that inotify mechanism can be used by smbd to at least tell windows that the lease/oplock should be broken now. /mjt