Samba oplock level II problem

Pavel Shilovsky piastryyy at gmail.com
Mon Jan 24 07:57:05 MST 2011


Hello!

I reported about an oplock level II problem in
https://bugzilla.samba.org/show_bug.cgi?id=7928. I want to discuss it
here because I think it's the real seriuos bug, that can raise a lot
of data coherency problems.

So, the bug is: Samba doesn't aware about mandatory byte-range locks
held by client when it grants any level of oplock. It means that Samba
can grant oplock level II to one client while another client holds
such a byte-range lock. As the results, we can see that client with
oplock level II can't process read-ahead operations (such as
pagereading in Linux kernel CIFS client):
1) client1 hold mandatory byte-range lock from 1 to 2.
2) client2 (with oplock level II) want to read 1 byte from 0 position.
  2.1) according to Oplock Level II VFS driver reads whole page (from
0 to 4096) and fails (!).
  2.2) client2 gets EACCESS error - so it can't read from 0 to 1 (what
it wants) and thinks that there is mandatory byte-range lock from on
the are from 0 to 1, but it isn't true!

Now, let's look at the some oplock's related official materials:
http://msdn.microsoft.com/en-us/library/cc308443.aspx
http://msdn.microsoft.com/en-us/library/ff549259(v=vs.85).aspx

Some re-phrases:
"Level2 oplocks can be granted if there are no current Byte Range
Locks on the stream".
"Level2 oplocks are always broken to None on every byte range lock
operation on the given stream."

Of course, we don't need such a check for POSIX advisory locking style
- only for mandatoryWindows locking. Linux kernel client supports
mandatory style while communicating with Samba too - with nounix and
forcemand mount options.

-- 
Best regards,
Pavel Shilovsky.


More information about the samba-technical mailing list