Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Aug 1999 08:35:25 -0600
From:      Wes Peters <wes@softweyr.com>
To:        Christopher Masto <chris@netmonger.net>
Cc:        Greg Lehey <grog@lemis.com>, Chuck Robey <chuckr@picnic.mat.net>, 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:  <37C2ADAD.B1F19098@softweyr.com>
References:  <19990823223645.A14001@netmonger.net> <Pine.BSF.4.10.9908232256550.49952-100000@picnic.mat.net> <19990823231130.A16133@netmonger.net> <19990824125210.A83273@freebie.lemis.com> <19990823233434.C16133@netmonger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Christopher Masto wrote:
> 
> How about a little timing difference?
> 
> User 1                          User 2
> 
>                                 open file
>                                 read file
> open file
> lock file (blocks?)
>                                 close file
> lock returns                    open file (blocks)
> diddle file
> unlock file
>                                 scribble over User 1's changes
> 
> What I'm getting at is that if User 2 has to do something special
> anyway, it might as well be using advisory locking.

You've got this so wrong, perhaps you should just go find a System V man
page and read about mandatory locking before embarassing yourself any-
more.

Locking will only block if another process is holding an overlapping lock.
opening won't block due to mandatory locking.  The only operations that
can block are read and write, and then only if the read or write operation
will overlap a locked range of bytes.

Your example above is a perfect example of a poorly written program doing
something stupid.  If you allow poorly written programs to do stupid
things on top of YOUR critical data files, that is your problem.  Not having
mandatory locking is OUR problem.  If you don't want it, just leave "option
LOCKING" out of your kernel.

-- 
            "Where am I, and what am I doing in this handbasket?"

Wes Peters                                                         Softweyr LLC
http://softweyr.com/                                           wes@softweyr.com


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?37C2ADAD.B1F19098>