lockf()/lockd problems
Mark Bartelt
sysmark at physics.utoronto.ca
Tue Mar 19 02:32:41 AEST 1991
Am I just overlooking something obvious, or does lockf() not work properly on
NFS-mounted volumes? More specifically, the lock gets created, but doesn't get
removed when the requesting process exits.
I R'ed TFM, and TFM claims (in the lockf(3c) man page) that
All the locks for a process are removed when the process terminates.
However, this seems to happen only for local files, not for NFS-mounted ones.
For the latter, subsequent attempts to do a test-and-lock (by using F_TLOCK)
return EACCES. For example:
% x /usr/people/sysmark/tmp/foo # This file is on the client
/usr/people/sysmark/tmp/foo: ok
% x /usr/people/sysmark/tmp/foo
/usr/people/sysmark/tmp/foo: ok
%
% x /hemlock/sysmark/tmp/snarf # This file is on the server
/hemlock/sysmark/tmp/snarf: ok
% x /hemlock/sysmark/tmp/snarf
/hemlock/sysmark/tmp/snarf: lock error 13 # GACK!
%
The trivial program "x" (source appended below) just does an open/lockf/close
for each file named on the command line. Configuration details: The program
was run on a 4D/25 running IRIX 3.3.1; the server is a 4D/280 running 3.3.2.
And lockd/statd are running on both systems.
Is this just a horrible botch in lockf() and/or lockd? Or (more likely) have
I just missed something in TFM?
------------------------------------- x.c -------------------------------------
#include <unistd.h>
extern int errno;
main(ac,av)
int ac;
char ** av;
{
int fd;
while ( --ac > 0 )
if ( (fd=open(*++av,2)) < 0 )
printf("%s: open error\n",*av);
else {
if ( lockf(fd,F_TLOCK,0) < 0 )
printf("%s: lock error %d\n",*av,errno);
else
printf("%s: ok\n",*av);
close(fd);
}
exit(0);
}
-------------------------------------------------------------------------------
Mark Bartelt 416/978-5619
Canadian Institute for sysmark at cita.toronto.edu
Theoretical Astrophysics sysmark at cita.utoronto.ca
More information about the Comp.sys.sgi
mailing list