level2 oplocks

Syzop syz at dds.nl
Tue Jun 26 23:30:51 GMT 2001


Hi,

I've been thinking of adding an option in smb.conf to
only use (per share/global) level 2 oplocks (instead of exclusive[/batch]).
I can imagine this would make sense for shares (like I have) which only
contains programs (.exe files), which are not writable by clients (never get changed).
In the current situation it goes:
A wants to open netscape.exe and gets an exclusive oplock
B wants to open netscape.exe too, now:
- an oplock_break is sent to A (maybe downgrade to level II)
- samba has to wait until A has acknowledged it has released the oplock.
- B gets an level II oplock
In this case it would be faster if we skip the oplock break/downgrade part by
not granting an exclusive oplock the first time but a level 2, so you get:
A wants to open netscape.exe and gets an level2 oplock
B wants to open netscape.exe and gets an level2 oplock

Another option is, to check if the client who opens the file, has only read permission
(or requests RDONLY), if so; give a level 2 oplock instead of an exclusive one.
But that might be sometimes slower cause you then can't have batch oplocks,
and maybe even more important: clients which don't support level2 oplocks can't
use oplocks at all.
Of course variations are possible, like:
- disabling by default, so users should only enabling this in case they only have
   NT(/w2k/etc) clients which support level 2 oplocks..
- granting an exclusive oplock (anyway) if the client doesn't support level2 oplocks (I dunnow
   if you can detect this?).
The only problem you still have is the batch oplock stuff which you loose.

I've already changed my samba source to have a 'level2 only' option (the 1st thing I was
talking about), and I think I'll try it soon at school to see if it works ok.
The 2nd proposal is something I just thought off and I first wanted to know if it
would make sense before I start coding :P.

    Syz.






More information about the samba-technical mailing list