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

Michael Tokarev mjt at tls.msk.ru
Fri Jan 20 09:10:49 UTC 2023


I'm trying to understand how various ways to grant a file lease to (windows) clients
works. Especially in context when files are being modified locally on the linux

For example, there's this wording in man smb.conf:

  kernel share modes
      Kernel share modes provide a minimal level of interoperability with
      local UNIX processes and NFS operations by preventing access
      corresponding to the SMB share modes. This requires a file system
      specific VFS module with proper support.

      This parameter defaults to no. Setting it to yes requires a file
      system module that supports file system sharemodes, otherwise
      attempts to access files will fail with a sharing violation.

So there are a few questions in there. First of all, am I reading it
right, the result is that local processes can't modify the locked
files? To be fair, I have never seen this happen, to the point when
I don't think this is possible. Unless, ofcourse, the local linux
application which modifies files locally, does some locking like

Also it is not clear which VFS module is needed in this case.

There's another parameter, `change notify', but it is also not
clear when/how this feature is used. From the parameter name it
smells like samba will be notifying client about file changes
on the server, but it looks like the client have to "subscribe"
to the changes somehow first?

Which mechanisms samba has to tell (windows) clients about file
changes on the share? Does something of that work with file
leases granted to clients?

What I'm trying to understand is how I should configure things and
how I should do these things in order to tell the clients about
changed files on server but still to allow clients to cache/lease
the files for better performance.

Browsing the 'net it looks like this topic is commonly misunderstood.



More information about the samba mailing list