Why fcntl(SETLKW) can fail ?

From: J.A. Magallon (jamagallon_at_able.es)
Date: 03/07/04

  • Next message: Administrator_at_vger.kernel.org: "Symantec Mail Security detected that you sent a message containing an executable file. (SYM:40199701240766837106)"
    Date:	Sun, 7 Mar 2004 23:31:50 +0100
    To: Lista Linux-Kernel <linux-kernel@vger.kernel.org>
    
    

    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/
    

  • Next message: Administrator_at_vger.kernel.org: "Symantec Mail Security detected that you sent a message containing an executable file. (SYM:40199701240766837106)"

    Relevant Pages

    • Re: File locking between Linux server and HP-UX 10.20 client
      ... > We are running into odd file locking problems between our NFS server ... ..from one of the HP clients. ... the portmapper on the server and whether a lock service is available. ...
      (comp.sys.hp.hpux)
    • Re: Database path from DSN (MSDE) (2nd. attempt)
      ... it is not possible to open Access in exclusive mode. ... a lock field using MsAccess (I didn't continue testing with SQL ... BeginTrans/CommitTrans pairs during the EOD. ... >In SQL Server, have a table that has a field that indicates all uses should ...
      (microsoft.public.vc.mfc)
    • HKLM locking
      ... It is not possible to lock the machine from the ... Vulnerability was discovered because one, ... server as the argument, lock will be performed on that server. ... void PrintLastErrorString(DWORD gla); ...
      (Vuln-Dev)
    • HKLM locking
      ... It is not possible to lock the machine from the ... Vulnerability was discovered because one, ... server as the argument, lock will be performed on that server. ... void PrintLastErrorString(DWORD gla); ...
      (Bugtraq)
    • RE: Desktop goes blank after selecting Lock from Loggin Screen
      ... it occurs once I choose to log off or lock the server. ... Microsoft CSS Online Newsgroup Support ... newsgroups so that they can be resolved in an efficient and timely manner. ...
      (microsoft.public.windows.server.sbs)