Skip site navigation (1)Skip section navigation (2)
Date:      24 Aug 1999 11:18:42 +0300
From:      Ville-Pertti Keinonen <will@iki.fi>
To:        chuckr@picnic.mat.net (Chuck Robey)
Cc:        grog@lemis.com, hackers@freebsd.org
Subject:   Re: Mandatory locking?
Message-ID:  <86so59k2vx.fsf@not.demophon.com>
In-Reply-To: chuckr@picnic.mat.net's message of "23 Aug 1999 18:34:34 %2B0300"
References:  <86zoziwp88.fsf@not.demophon.com> <Pine.BSF.4.10.9908231125480.49952-100000@picnic.mat.net>

next in thread | previous in thread | raw e-mail | index | archive | help

chuckr@picnic.mat.net (Chuck Robey) writes:

> On 23 Aug 1999, Ville-Pertti Keinonen wrote:

> > And even without otherwise incorrect behavior, if you have a program
> > that doesn't use any locking and another one that uses mandatory
> > locking to prevent races with the non-locking program, the mere
> > existence of the locking program does not prevent multiple non-locking
> > programs from generating similar conditions.
> 
> That's very odd, I thought the idea behind mandatory locking was to
> completely eliminate the possibility that a program could do what you're
> saying; all programs would *mandatorily* be forced to do locking to
> access the resource.

I don't know what the textbook definition for mandatory locking is,
but was assuming (particularly considering the proposal to use a fcntl
interface) that by mandatory locking, Greg was referring to a "harder"
lock than current advisory locking, one that had to be instantiated
explicitly but would not only lock out other attempts to lock, but all
other attempts to access the file.

The further messages in this the thread seems to indicate that
different individuals have different definitions for mandatory
locking...  I'd still assume that marking a file to be accessible by
only one process at a time is *not* what is being discussed.
Particularly since it is not even clear what this would mean for
forked processes, dup, sending file descriptors over local sockets
etc.

Note that my arguments earlier don't apply in a case where you might
want to e.g. ensure consistency for non-locking programs with
read-only access, with the only program with privileges to modify the
data making the data inaccessible during updates.  This is a scenario
where it would, IMHO, actually be quite useful to have mandatory
locking.

In any case, if shared (open) access is allowed, such a feature can
introduce semantic changes to read/write system calls - normally,
read/write can never return EAGAIN or block for unlimited amounts of
time on regular, local files.  EAGAIN is not that much of a problem,
as it requires explicitly setting O_NONBLOCK, but blocking can
introduce new deadlocks.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86so59k2vx.fsf>