nis problem in new nfs (2.1.50 vs. 2.1.42)

Christoph Trautwein (trautwein@scientist.com)
Wed, 20 Aug 1997 10:21:49 +0200


I can't run nis on 2.1.50 because of the following strange
problem:

The nis code (see below) opens a file, then deletes it, but
keeps the fd. I use nis on my diskless clients. Tracing nis
gives me
open(...)
truncate(...)
unlink(...)
read(...)
as expected. The difference between 2.1.42 and 2.1.50 is,
that the read returns a "NFS stale handle" on 2.1.50.
This causes nis to quit.

I know that the nis code is very ugly, but I think the
nfs code should support it. (Hi Olaf!!)

What do you think?

Christoph

--------------------
excerpt from slave.c:

int
open_lockfile(void)
{
char name[L_tmpnam];
int fd;

if (NULL == tmpnam(name))
log_sys("tmpnam failed");

fd = open(name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (fd < 0)
log_sys("cannot open lockfile");
/* Need to extend the file for mmap + fcntl */
if (0 != ftruncate(fd, sizeof(struct binding) * _MAXDOMAIN))
log_sys("ftruncate");
/* remove the file, but keep it open, so we have an invisible
* lockfile. Note: This does not work with NFS-mounted directories
* on some systems. */
unlink(name);
return fd;
}

---------