Oplock question/problem ???

Simon Hyde shyde at poboxes.com
Sun Feb 15 19:49:31 GMT 1998


On Fri, 13 Feb 1998 05:22:12 +1100, you wrote:
>Jesse Book Jr wrote:
>> 
>>        My Problem...  When the files are saved to my samba share I can not
>> acces the files because they show that they are still locked.  If I wait
>> the locks will eventually disappear, but with the writers having deadlines
>> for delivery it makes it important for me to access the files as soon as
>> they are available.  Turning off the oplocks makes it possible to access
>> the files immediately.
>>         My Question...  Is this normal behavior for oplocks?  I was under the
>> impression that when the file was closed, or the application terminated the
>> file's lock should die as well.
>
>What client OS are you using ? The Win95 redirector has a nasty 
>habit of keeping batch oplocked files open long after the application
>has actually closed the file. WinNT seems to suffer less than this.
>
>Hmmmm. What you could do to get the current version of the
>file (and break the oplock) is to use smbclient to connect
>to the Samba server and then copy the file to another name
>(probably where you want to put it anyway). This will
>force the client to break the oplock. I used this to
>break oplocks on demand when developing the oplock code.
>
>The only downside is you cannot be absolutely sure that
>the person has finished editing the file at that point,
>as the Windows redirector is hiding that from you.
>
>Maybe I should add a 'break oplock after XX minutes
>of inactivity parameter'..... Hmmmmm. That might make
>some things a lot slower though.

How about a 'breakoplock' command which can be used by root or the user
that has the oplock (or any user if specified in smb.conf?) to force an/all
oplock(s) to be broken (and kept broken for a specified amount of time? or
until breakoplock is called again?), so that things on the Unix side that
manage files on Samba shares can first run this before trying to use the
contents of a file? Just an idea I've been mulling over for a while, if
it's feasable it could solve some of the "problems" that people have been
having with oplocks.

Simon Hyde
-----------------------------------------------------------
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.


More information about the samba mailing list