Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AIX Bug: fcntl hangs when locking NFS file?

152 views
Skip to first unread message

J. Kenneth Gentle

unread,
Oct 10, 1994, 8:29:21 AM10/10/94
to

I've developed a small utility that makes use of advisory
locking via the "fcntl" system service. It works as expected
on local file systems. However, the fcntl service never
returns (program hangs and can't be killed) when attempting to
establish a lock on a remote file system (mounted via NFS).

I've tested the program on AIX 3.2.4 accessing a file on a
remote AIX box (3.2.5) and vice versa. I've also tested on a
combination of HP/UX and IBM systems with the same behavior.
HP said it was a bug in their implementation and have made the
patches available to us (still applying patches so I don't
know if it is going to fix the problem.)

Is this a known problem with AIX's implementation of NFS? Is
there a PTF available?

The code included below can be used to duplicate the problem.
Replies or e-mail responses welcome.

Thanks!

Ken


AIX LEVEL:3.2.4, 3.2.5

ENV: 340 exports file system to 530H, mounted via NFS.
File system is exported with rw access to 530H.


TESTCASE:
/*
** Build via: c89 -o nfs-fcntl nfs-fcntl.c
** Invoke like: nfs-fcntl <local-file-system-path> <remote-file-system-path>
*/
#define _XOPEN_SOURCE 1
#define _XPG4 1
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>

extern int main (int argc, char *argv[])
{
int i;
FILE *fp;
struct flock flk;

for (i=1; i<argc; ++i) {
errno = 0;
if (NULL != (fp = fopen (argv[i], "r+"))) {
flk.l_type = F_RDLCK;
flk.l_whence = SEEK_SET;
flk.l_start = 0;
flk.l_len = 0;
if (-1 != fcntl (fileno(fp), F_SETLK, &flk)) {
fclose (fp);
}
else {
fprintf (stderr, "fcntl failed on file %s\n\t%s\n",
argv[i],strerror (errno));
}
}
else {
fprintf (stderr, "fopen failed on file %s\n\t%s\n",
argv[i],strerror (errno));
}
}
}

--
===============================================================================
J. Kenneth Gentle (Ken) | Phone: (302) 733-3052 FAX:(302) 774-7321
DuPont Information Systems | Email: gent...@gentlejk.wm.dupont.com
===============================================================================

Jim Katz

unread,
Oct 15, 1994, 11:19:49 PM10/15/94
to
gent...@gentlejk.lvs.dupont.com (J. Kenneth Gentle) writes:


> I've developed a small utility that makes use of advisory
> locking via the "fcntl" system service. It works as expected
> on local file systems. However, the fcntl service never
> returns (program hangs and can't be killed) when attempting to
> establish a lock on a remote file system (mounted via NFS).

I believe this is a bug in AIX. We had exactly the same problem
in SunOS4, under the same condifito tions: Lock a remote file
hangs. Sun'finally admitted it was theirs. No amount of timeout,
etc. would fix it.

Jim Katz j...@world.std.com

0 new messages