Article View: comp.std.unix
Article #224File Locking across NFS mounts
From: "Steven F. LeBrun"
Date: Tue, 08 Sep 1992 21:04
Date: Tue, 08 Sep 1992 21:04
32 lines
1899 bytes
1899 bytes
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.
I tried flock() and discovered a bug that only exists if the file
being locked is a remote (NFS) file. If a program terminates without
unlocking an NFS file (due to a system reboot, user abort, program
bug [this is how I discovered the problem -- bugs can be useful at
times :-) etc.] the file remains locked so that no other programs
can access the file.
The programs that access the file are running on different computers
with the same file accessible via NFS mounts. Currently, the programs
are all running on SGI Indigo's (IRIX 4.0.1) and other computers of
unknown type will be added later. I would prefer staying with advisory
file locking but manditory file locking is an option. Since the file
being locked is a log/audit trail file that the programs append their
next entries, locking the entire file is acceptable. Locking the next
local record (next entry) and the entire file will have the same
effect on the programs accessing the file.
--
Steven F. LeBrun
lebrun@ll.mit.edu
[ Note crosspostings, and Followup line. Feel free to post any followups
here (comp.std.unix) if you feel it relevent. -- mod ]
Volume-Number: Volume 29, Number 21
Technical Details
Message-ID:
<18j4hdINNdst@ftp.UU.NET>Path:
arc1-ca.pugleaf.net!sparky!uunet!uunet!not-for-mailShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!uunet!not-for-mail
From: lebrun@ll.mit.edu ("Steven F. LeBrun")
Newsgroups: comp.std.unix,comp.unix.programmer
Subject: File Locking across NFS mounts
Followup-To: comp.unix.programmer
Date: 8 Sep 1992 14:04:45 -0700
Organization: MIT Lincoln Laboratory, Lexington, MA
Lines: 32
Sender: sef@ftp.UU.NET
Approved: sef@ftp.uucp (Moderator, Sean Eric Fagan)
Message-ID: <18j4hdINNdst@ftp.UU.NET>
NNTP-Posting-Host: ftp.uu.net
X-Submissions: std-unix@uunet.uu.net