Newsgroups: comp.sys.sgi Path: utzoo!news-server.csri.toronto.edu!helios.physics.utoronto.ca!aurora.physics.utoronto.ca!sysmark From: sysmark@physics.utoronto.ca (Mark Bartelt) Subject: lockf()/lockd problems Message-ID: <1991Mar18.163241.13680@helios.physics.utoronto.ca> Originator: sysmark@aurora.physics.utoronto.ca Sender: news@helios.physics.utoronto.ca (News Administrator) Nntp-Posting-Host: aurora.physics.utoronto.ca Reply-To: sysmark@cita.utoronto.ca Organization: University of Toronto Physics/Astronomy/CITA Date: Mon, 18 Mar 1991 16:32:41 GMT 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 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@cita.toronto.edu Theoretical Astrophysics sysmark@cita.utoronto.ca