Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Aug 1999 14:39:53 -0400
From:      Christopher Masto <chris@netmonger.net>
To:        Chuck Robey <chuckr@picnic.mat.net>
Cc:        Wes Peters <wes@softweyr.com>, Greg Lehey <grog@lemis.com>, Garance A Drosihn <drosih@rpi.edu>, "Daniel C. Sobral" <dcs@newsguy.com>, Poul-Henning Kamp <phk@critter.freebsd.dk>, Matthew Dillon <dillon@apollo.backplane.com>, FreeBSD Hackers <hackers@FreeBSD.ORG>, FreeBSD Committers <cvs-committers@FreeBSD.ORG>, Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
Subject:   Re: Mandatory locking?
Message-ID:  <19990824143953.A19375@netmonger.net>
In-Reply-To: <Pine.BSF.4.10.9908241129320.49952-100000@picnic.mat.net>; from Chuck Robey on Tue, Aug 24, 1999 at 11:33:33AM -0400
References:  <19990824111703.B10650@netmonger.net> <Pine.BSF.4.10.9908241129320.49952-100000@picnic.mat.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 24, 1999 at 11:33:33AM -0400, Chuck Robey wrote:
> > Yes, it's WRONG code.  Correct code would aquire a lock before
> > reading.
> 
> My understanding of "mandatory locking" means that a program that
> completely ignores any locking at all, if it tries to grab the locked
> resource, will sleep until the resource is unlocked.  This means that
> the program is mandatorily forced to obey other program's lock requests.
> It does not force that program to do it's own locks, but it forces it to
> respect others.  Is that the kind of mandatory locking we're talking
> about?
> 
> The rogue program, which doesn't do locking, can have it''s data
> corrupted, but it cannot corrupt the data for a correctly written
> program's transaction.

I'm going to keep out of this thread from now on, but I want to answer
this first.  The "correctly written program" may aquire the lock and
perform its transaction between the time the "rogue program" has read
data and the time it is going to write that data back.  In this case,
mandatory locking only means that the rogue stalls in the middle, but
it's still working with incorrect data.  I don't think there's any
way to update a file properly other than to aquire a lock before
reading and to hold it until after writing.

If the process with the mandatory locking is the only process that
ever writes to the file, it may be OK.  That seems a somewhat narrow
use for the thing.

I'm going to defer any futher comment until I see an implementation.
It seems, as I said before, that it's not even clear to those
participating in this discussion exactly what the definition of
"mandatory locking" is intended to be.  I never got to use MTS, but
Garance seems to be saying that certain files could be flagged
(perhaps this was the default) such that you can't access them at all
if you don't aquire a lock.  Others are implying that a
"non-compliant" program only blocks if there is a lock on the file.

As for "if you don't like it, don't enable it".. that's only an option
if nothing appears that depends on it.
-- 
Christopher Masto         Senior Network Monkey      NetMonger Communications
chris@netmonger.net        info@netmonger.net        http://www.netmonger.net

Free yourself, free your machine, free the daemon -- http://www.freebsd.org/


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?19990824143953.A19375>