[Samba] Change Filelocking

Urban Widmark urban at teststation.com
Mon Jul 15 15:27:23 GMT 2002

On Mon, 15 Jul 2002, J.Strohschnitter wrote:

> Hi there,
> is it possible and when, how - to change the filelocking-status of an opened 
> file from EXCLUSIVE+BATCH to another status ?
> We have to open an file to write at the same time from different pc's into 
> this file.
> For example the following smbstatus -u USER output:
> Pid    DenyMode   Access      R/W        Oplock           Name
> DENY_DOS   0x1         RDONLY     EXCLUSIVE+BATCH kund.dat
> But we have to change it from RDOnly to RW and the OPLOCK to anything else

I think you have got things a bit backwards here ...

An oplock is something the server gives to the client that basically says 
that the client can cache the file and any operations on it. When someone 
else opens the file the server will send an oplock break to the client and 
the oplock will be set to none.

It is not exclusive in the meaning that no one else can open the file, it
is exclusive in the meaning that no one else has opened the file (yet). 
This client knows that it is the only user of this file.

If you are on a system with kernel oplock support the only thing you need
to do is open the file on the server and that will break the oplock. But
the same thing happens if another client opens the file.

RDONLY is the mode that this client has the file opened with. If someone
else opens the file they will get RW or whatever they ask for and the 
server wants to give them.

You can't change the mode a client has opened the file with, only the
client can do that. But obviously if client A opens with RW that does not
mean that client B automatically opens it RW.

I believe DENY_DOS could be your problem. I'm not 100% sure of the
details, but there are different modes that files can be opened in. And
they can differ in what they allow others clients to do.

Again, this is how the client requested the file to be opened and is not
something you can change from the server. You could perhaps change how the
client opens the file though.

I think you should state your problem from a different angle. Start a
new thread explaining what you are trying to do and what it is that
isn't working.


More information about the samba mailing list