home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!uunet!not-for-mail
- From: johnl@iecc.cambridge.ma.us ("John R. Levine")
- Newsgroups: comp.std.unix
- Subject: Re: File Locking across NFS mounts
- Date: 10 Sep 1992 16:40:51 -0700
- Organization: I.E.C.C.
- Lines: 32
- Sender: sef@ftp.UU.NET
- Approved: sef@ftp.uucp (Moderator, Sean Eric Fagan)
- Message-ID: <18ome3INN8vj@ftp.UU.NET>
- References: <18j4hdINNdst@ftp.UU.NET>
- Reply-To: std-unix@uunet.UU.NET
- NNTP-Posting-Host: ftp.uu.net
- X-Submissions: std-unix@uunet.uu.net
-
- Submitted-by: johnl@iecc.cambridge.ma.us ("John R. Levine")
-
- >Submitted-by: lebrun@ll.mit.edu ("Steven F. LeBrun")
- >I am looking for a method of file locking what works across NFS
- >mounted directories and am interested on what methods other
- >people are using.
-
- You aren't likely to get very satisfactory results using record locking.
- Many versions of the locking daemon don't work at all, and the crash
- recovery seems to me to be hopelessly amateurish. I've worked on projects
- that tried to use record locking and even after doing six backflips to try
- and work around the record locking bugs, at least to get to the point that
- we didn't just hang if the locking daemon wasn't working, the results
- still were not great.
-
- The time-honored technique of using a directory as a semaphore and using
- mkdir() and rmdir() as lock and unlock works fairly well, although it's
- rather slow. Using link() and unlink() also works, at least on systems
- that use the Unix semantics that you can't link on top of an existing
- file.
-
- If you're serious about having the locks work, in the long run you'll get
- much better results if you write your own daemon that listens to a TCP/IP
- socket and handles reserve and release messages, or maybe even manages the
- file itself and accepts requests to atomically update and read from the
- file.
-
- Regards,
- John Levine, johnl@iecc.cambridge.ma.us, {spdcc|ima|world}!iecc!johnl
-
-
- Volume-Number: Volume 29, Number 31
-