All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Lista Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Locking over NFS
Date: Fri, 28 Nov 2003 00:09:37 +0100	[thread overview]
Message-ID: <20031127230937.GA23147@werewolf.able.es> (raw)

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

             reply	other threads:[~2003-11-27 23:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-27 23:09 J.A. Magallon [this message]
2003-11-28  1:01 ` Locking over NFS Trond Myklebust
2003-11-28  1:12   ` Trond Myklebust

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=20031127230937.GA23147@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.