Samba 3.0.32 - oplock code

Jeremy Allison jra at
Thu Dec 11 17:10:18 GMT 2008

On Thu, Dec 11, 2008 at 11:22:02AM +0200, Itay Dar wrote:
> Hi, 
> 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.

An alternative is to send out the messages to all 
level2 holders and then have the lock holding process
do the downgrades on the share mode data itself whilst
holding the lock rather than have the receiving processes
do it after they got the message.

I think that will remove the race and won't introduce
any possible errors - after all, sending the messages
out to the clients are asynchronous anyway.

I'll take a look at your patch, but won't be able
to commit anything until Tues of next week.



More information about the samba-technical mailing list