lkml.org 
[lkml]   [2003]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectLocking over NFS
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:5.355 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site