mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Lista Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Why fcntl(SETLKW) can fail ?
Date: Sun, 7 Mar 2004 23:31:50 +0100	[thread overview]
Message-ID: <20040307223150.GA30562@werewolf.able.es> (raw)

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))

                 reply	other threads:[~2004-03-07 22:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040307223150.GA30562@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®