Samba 3.0.32 - oplock code

Itay Dar Itay.Dar at
Thu Dec 11 09:22:02 GMT 2008

Yes, it solves my original posting, but the following case Is missing. 
If someone is asking for an oplock level two and at least one share lock
entry doesn't have a level two oplock or a fake one, than this request
should be also denied.
Also  an exclusive oplock cant be granted  if no one has an oplock level
two, but that seems as a code glitch. 

I am attaching my patch suggestion below.

I have also notice there is a potential  race between the
release_level_2_oplocks_on_change and the open_file_ntcreate functions.
Lets say someone just issued a release_level_2_oplocks_on_change call,
he will take the tdb lock, send the oplock break request to everyone
else (including himself) and than unlock the share entry, lets say
someone is waiting on the tdb lock coming from the open_file_ntcreate ,
he will view the share entries notice they are all having an level two
oplock or a fake one, and will get himself a level two oplock, but all
other owners are going to be downgrade to a non oplock so future changes
coming from them wont reach him.
I will try to think on a possible remedy, and send a suggestion.

Thank you very much, 
Itay dar

-----Original Message-----
From: Jeremy Allison [mailto:jra at] 
Sent: Thursday, December 11, 2008 3:10 AM
To: Jeremy Allison
Cc: Itay Dar; samba-technical at
Subject: Re: Samba 3.0.32 - oplock code

On Wed, Dec 10, 2008 at 03:53:56PM -0800, Jeremy Allison wrote:
> On Wed, Dec 10, 2008 at 05:20:05PM +0200, Itay Dar wrote:
> > Hello,
> > I am reading the oplock granting code in samba 3.0.32 And I have a 
> > question, if I may.
> > 
> > It seems to me that if someone is asking for an exclusive lock or 
> > level two oplock when all other share lock owners of the files don't

> > have any oplock (not even a fake level two)  he will be granted a 
> > level two oplock.
> > But if one of the other clients will perform a write operation or 
> > anything else, he wont notify the level oplock 2 holder on the async

> > oplock break needed.
> > 
> > I have checked samba . 3.0.20, and it seems no oplock is granted in 
> > that case in the old version.
> > 
> > I think there are two possibilities for a solution, send everyone 
> > else a request two make  fake level two oplock upgrade or just deny 
> > the oplock request from the client.
> > I have a patch for the second suggestion.
> > 
> > Am I right ?
> I'd like to see your patch to be sure, but this sounds very plausible.

> Could you send it to the list please ?

Does this patch fit what you're talking about (created for 3.2.x and
above, but should be similar in 3.0.x) ?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: look
Type: application/octet-stream
Size: 1233 bytes
Desc: look
Url :

More information about the samba-technical mailing list