[comp.unix.ultrix] Bug in DECstation Ultrix 3.1 NFS locking?

trt@rti.UUCP (Thomas Truscott) (10/02/89)

We have been trying like crazy to get "lockf" to work
correctly under DECstation Ultrix3.1, to no avail.

Repeat By:
	From one DECstation, "cd" to an NFS-mounted directory
	on another DECstation (or Sparcstation), "touch foo",
	and run the following program:

	#include <unistd.h>
	main()
	{
		int fd, rc;

		fd = open("foo", 2);
		printf("locking file ...\n");
		rc = lockf(fd, F_LOCK, 0);
		printf("lock => %d\n", rc);
		close(fd);
		printf("exiting\n");
		exit(0);
	}

	The lockf() and close() calls pause for 5 seconds each.
	(The lockf reports success, but it can be verified
	that the file is locked only on the local system.)

Help!  Is this a known bug or a configuration problem or what?
We need to know ASAP.  Post a reply or send EMAIL,
but also please call me (collect).
	Tom Truscott, trt@rti.rti.org, uunet!mcnc!rti!trt
	(919) 541-7005

grr@cbmvax.UUCP (George Robbins) (10/04/89)

In article <3196@rti.UUCP> trt@rti.UUCP (Thomas Truscott) writes:
> We have been trying like crazy to get "lockf" to work
> correctly under DECstation Ultrix3.1, to no avail.
> 
> Repeat By:
> 	From one DECstation, "cd" to an NFS-mounted directory
> 	on another DECstation (or Sparcstation), "touch foo",
> 	and run the following program:
> 
> Help!  Is this a known bug or a configuration problem or what?
> We need to know ASAP.  Post a reply or send EMAIL,
> but also please call me (collect).

% man flock

                                                         flock(2)
NAME
     flock - apply or remove an advisory lock on an open file
...

RESTRICTIONS
     File region locking is not supported over NFS.

-- 
George Robbins - now working for,	uucp: {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr@uunet.uu.net
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)

riley@batcomputer.tn.cornell.edu (Daniel S. Riley) (10/04/89)

In article <8076@cbmvax.UUCP> grr@cbmvax.UUCP (George Robbins) writes:
>In article <3196@rti.UUCP> trt@rti.UUCP (Thomas Truscott) writes:
>> We have been trying like crazy to get "lockf" to work
>> correctly under DECstation Ultrix3.1, to no avail.

>% man flock
>
>                                                         flock(2)
>NAME
>     flock - apply or remove an advisory lock on an open file
>...
>
>RESTRICTIONS
>     File region locking is not supported over NFS.

% man lockf

NAME
     lockf - record locking on files
...
     File region locking is supported over NFS, if the NFS lock-
     ing service has been enabled.

Seems a bit contradictory, doesn't it.  Have you used nfssetlock to enable
NFS locking service?  (Apologies if this is too obvious--I'm still a novice
at managing Ultrix systems.)

-Dan Riley (riley@tcgould.tn.cornell.edu, cornell!batcomputer!riley)
-Wilson Lab, Cornell U.

grr@cbmvax.UUCP (George Robbins) (10/05/89)

In article <9001@batcomputer.tn.cornell.edu> riley@tcgould.tn.cornell.edu (Daniel S. Riley) writes:
> In article <8076@cbmvax.UUCP> grr@cbmvax.UUCP (George Robbins) writes:
> >In article <3196@rti.UUCP> trt@rti.UUCP (Thomas Truscott) writes:
> >> We have been trying like crazy to get "lockf" to work
> >> correctly under DECstation Ultrix3.1, to no avail.
> 
> >RESTRICTIONS
> >     File region locking is not supported over NFS.
vs.
> ...
>      File region locking is supported over NFS, if the NFS lock-
>      ing service has been enabled.
> 
> Seems a bit contradictory, doesn't it.  Have you used nfssetlock to enable
> NFS locking service?  (Apologies if this is too obvious--I'm still a novice
> at managing Ultrix systems.)

Oops, sorry.  I knew there was some reason I was going to run catman (pain)
after doing the 3.1 upgrade.  It appears that NFS locking arrived with 3.1.

It seems that you need both an appropriate complement of daemons and to
run this enable program.  I'd consult the man pages for lockf and all
what's crossreferenced thereto and perhaps the 3.0 -> 3.1 upgrade notes.
If you've attended to all these details and still have a problem...

-- 
George Robbins - now working for,	uucp: {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr@uunet.uu.net
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)