knfs lock problem in 2.2.1

Craig J Copi (cjc5@po.cwru.edu)
Sat, 06 Feb 1999 17:19:19 -0500


I have knfsd running on a linux 2.2.1 box that exports my
home directory. On a different linux 2.2.1 I mount my home directory
and run the code at the end (it comes from GNU queue-1.11 so don't
blame me) on the client (that has nfs mounted the directory).
It prints
Lock error: No locks available
In /var/log/messages I find
kernel: lockd: failed to monitor 192.168.1.1
(naturally 192.168.1.1 is the server).

Should this work? I've tried a couple of patches I've seen
posted here by HJ Lu but none of them solved this.

Craig

--------------------- lock.c ---------------------------------------

#include <stdio.h>
#include <fcntl.h>
#include <errno.h>

int main (void)
{
int fd;
struct flock l;

l.l_type = F_WRLCK;
l.l_whence = SEEK_SET;
l.l_start = 0;
l.l_len = 0;

if ((fd = open ("tmp.tmp", O_WRONLY)) < 0) {
printf ("Error opening file\n");
exit (1);
}

if (fcntl (fd, F_SETLK, &l) < 0) {
perror ("Lock error");
} else {
printf ("File locked\n");
sleep (5);
}

exit (0);
}
------------------------------------------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/