lkml.org 
[lkml]   [2004]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectWhy fcntl(SETLKW) can fail ?
Hi all...

I have an strange problem with locking over nfs.
I wanto to lock a file, stored on a NFS server, and it used to work.
About 15 clients locked and unlocked the file. After several nodes were
added to the cluster (now total nodes are 45), suddenly, locks have
started to fail:

her002:~/giga> ask-lock kk
fcntl(SETLKW): No locks available

Code is just this:

#include <unistd.h>
#include <fcntl.h>
#include <cstdio>

int main(int argc,char*const* argv)
{
int fd;
struct flock lock;
int pid;

if (argc<2)
return 1;

while ((fd = open(argv[1],O_WRONLY)) < 0)
usleep(10000);

lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
lock.l_start = lock.l_len = 0;
if (fcntl(fd,F_SETLKW,&lock)<0)
{
perror("fcntl(SETLKW)");
return 1;
}
fchmod(fd,0);

return 0;
}

Kernel [lockd] is running both on server and clients. Some clients are still
able to lock the file, so the problem seems to be in the client side.
What is the problem ? Man page for fcntl states:

ENOLCK Too many segment locks open, lock table is full, or a remote
locking protocol failed (e.g. locking over NFS).

Is there any /proc entry to look at the lock table usage ?
Is there any problem wrt locks with the shared dir to be mounted by 45 clients ?
This really puzzles me...

Systems are Red Hat Linux release 9 (Shrike). Kernels:
- server: kernel-bigmem-2.4.20-8
- clients: 2.4.20-19.9smp, 2.4.20-20.9smp, 2.4.20-30.9smp

Any idea ?

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 (Community) for i586
Linux 2.6.4-rc1-jam2 (gcc 3.4.0 (Mandrake Linux 10.0 3.4.0-0.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 14:01    [W:0.032 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site