Locking over NFS
From: J.A. Magallon
Date: Thu Nov 27 2003 - 18:11:45 EST
Hi all...
Is locking via lockf/fcntl supposed to work over NFS mounted volumes
in 2.4 ?
I can't get it to work, even if kernel [lockd] is running in the server.
Server locks the file, and client gets an error:
annwn:~/dev/lk> lockf 10000
locked
<switch term>
annwn:~/dev/lk> bpsh 0 lockf
lockf:F_LOCK: No locks available
lockf.c:
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
int main(int argc, char** argv)
{
int fd;
fd = open("lock",O_RDWR);
if (fd<0)
perror("open");
if (lockf(fd,F_LOCK,0)<0)
perror("lockf:F_LOCK");
else
printf("locked\n");
fflush(stdout);
if (argc>1)
sleep(atoi(argv[1]));
if (lockf(fd,F_ULOCK,0)<0)
perror("lockf:F_ULOCK");
else
printf("unlocked\n");
fflush(stdout);
return 0;
}
TIA
--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
Mandrake Linux release 10.0 (Cooker) for i586
Linux 2.4.23-rc5-jam1 (gcc 3.3.1 (Mandrake Linux 9.2 3.3.1-4mdk))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/