IETF-SSH archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: A proposal for OPEN



On Thu, Sep 25, 2003 at 11:43:23AM -0600, Joseph Galbraith wrote:
> Derek Fawcus wrote:
> > But you also have the issue of mandatory vs advisory locks...
> 
> I've heard these terms before, but I'm not sure I've had them
> clearly defined for me before.  Let me see if I'm anyplace close
> on what they mean :-)
> 
>    Mandatory Lock
>    ==============
>    Once I am granted a mandatory lock, I own it until
>    I release it.  Others trying to access the file in
>    a way that conflicts with my lock will receive an
>    error.
> 
>    Advisory Lock
>    =============
>    Once I am granted an advisory lock, I own it until
>    either I release it or the server notifies me that
>    it is breaking my lock.  Others trying to access the
>    file in a way that conflicts with my lock will result
>    in the server breaking my lock.
> 
> Is this any place close to what these terms mean?

Well I was think more of the unix type advisory vs mandatory locks,
whereby with advisory locks,  locking is only implemented if requested,
i.e.

   process 1 opens the file,  requests a lock,  does i/o

   process 2 opens the file,  does i/o

if the kernel only implements advisory locks,  then process 2 can
(because it has no knowledge of the locking) interfere with the
i/o of process 1.  Furthermore process 1 never gets to find out.

So on a system that only implemented advisory locking,  having
a file accessed by SFTP (with locks) would not protect against
a local process manipulating the file.  This local process could
well be another SFTP instance,  or could be as simple as someone
truncating the file from a shell prompt with '> filename'.

Mandatory locks are as you describe - once locked other's can't
interfere.

DF



Home | Main Index | Thread Index | Old Index