[Samba] ok, so oplocks: good or bad?

John H Terpstra jht at samba.org
Fri Jun 20 19:38:01 GMT 2003

On Fri, 20 Jun 2003, Jonathan Johnson wrote:

> OK, I don't have a strong understanding of oplocks, but I'm sure someone
> will correct me where I go wrong.

Those interested in the whole OpLock story might benefit from reading
chapter 14 'File and Record Locking" of:


>From this coverage it should be obvious that file locking affects a
complex interaction of Client and Server protocols and configuration
settings. Please draw your own conclusions.

- John T.

> Overgeneralization #1: Disabling oplocks is ALWAYS a safe thing to do.
> Overgeneralization #2: Oplocks provide a performance boost by allowing the
> workstation (ws1) to cache a copy of the file locally and set an oplock.
> This way, the ws1 can assume it has exclusive access and doesn't need to
> read/write to/from the server for every operation. Occasionally, the ws1
> syncs the cached copy with the server copy. When another workstation (ws2)
> requests access to the file, the server asks the ws1 to break the oplock.
> Ws1 then syncs the cache with the server, and tells the server that it's
> released the oplock. The server then tells ws2 it can access the file. If
> ws1 has the file open for read (not write), ws2 can open the file for read
> without breaking any oplocks.
> Overgeneraliztion #3: With oplocks disabled, the workstation must always ask
> for an exclusive lock before writing to the file, and does not cache a copy.
> Another workstation can't access the file until the first workstation
> releases it.
> Exactly what goes on when things go wrong (server doesn't ask for oplock
> break; workstation doesn't release oplock, etc.) I can't tell you. As for
> the meaning of your errors, I haven't a clue.
> --Jon
> P.S. -- My philosophy is that if you ask a question and no one answers, tell
> a lie as gospel truth and everyone will.
> On 20 Jun 2003, Mark Roach wrote:
> > I have been searching for info on this and haven't found an
> > authoritative answer. From what I have read, oplocks are good because
> > they increase connection speeds, but they are bad because they don't
> > really work, but they actually do work, but they only work in some
> > cases, etc etc.
> >
> > so, here's my problem and my question together: I get tons of these
> > messages every day (over a thousand a day)
> >
> > [2003/06/20 08:19:42, 0] smbd/oplock.c:request_oplock_break(1011)
> >   request_oplock_break: no response received to oplock break request to
> >   pid 22335 on port 35010 for dev = 2b00, inode = 688540, file_id = 256210
> > [2003/06/20 08:19:42, 0] smbd/open.c:open_mode_check(652) open_mode_check:
> >   exlusive oplock left by process 22335 after break ! For file UHG/Local
> >   Settings/Temporary Internet Files/Content.IE5/desktop.ini, dev = 2b00,
> >   inode = 688540. Deleting it to continue...
> >
> >
> > is this an indication that I should disable oplocks, or is disabling
> > oplocks a foolish, unsafe thing to do, or is there just some other
> > problem I need to fix to allow me to keep using oplocks?
> >
> > Very confused.
> >
> > -Mark
> >
> >

John H Terpstra
Email: jht at samba.org

More information about the samba mailing list