All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Giersch <arnaud.giersch-T9cNH8bv7N6Vy8wrSkPSsihWMY4UYrEW@public.gmane.org>
To: linux-nfs@vger.kernel.org
Subject: BUG: cannot acquire lock twice with NFSv4
Date: Fri, 09 Apr 2010 15:05:14 +0200	[thread overview]
Message-ID: <wwer5mo3hf9.fsf@powwow.iut-bm.univ-fcomte.fr> (raw)

Hi,

I tried to experiment with NFSv4 to mount my home directory, but
bogofilter started to fail.
I was able to produce the following minimal test case, by writing a
program that:

  1. opens a first file, and acquires read lock on it ;
  2. opens a second file, and acquires read lock on it ;
  3. releases locks, and closes files.

Both opened files are of course on the NFS mount.  On the first run, all
seems to be fine.  On the second (and subsequent) runs, the lock is
refused at step 2 with errno=37 (ENOLCK, No locks available).

Steps 1 and 2 look like the following (I can provide the full source
code if needed):

    int fd = open(filename, O_RDONLY);
    struct flock lock = {
        .l_type = F_RDLCK,
        .l_whence = SEEK_SET,
        .l_start = 0,
        .l_len = 0,
    }
    fcntl(fd, F_SETLK, &lock);

Umounting and re-mounting the directory make the first run work again as
expected.  There is no problem with NFSv3, only with v4.

I first experimented the problem with the Debian kernels 2.6.26-2-amd64
for the server, and 2.6.33-2-amd64 for the client.
I also tried the latest kernel (2.6.34-rc3), either as client or as server
with no luck.

Regards,

        Arnaud Giersch


             reply	other threads:[~2010-04-09 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09 13:05 Arnaud Giersch [this message]
     [not found] ` <wwer5mo3hf9.fsf-RvotKtm/pmVc2QSU14wbDhqUABtTHcxU/fObgANad5s@public.gmane.org>
2010-04-10  8:46   ` BUG: cannot acquire lock twice with NFSv4 Arnaud Giersch
     [not found]     ` <wwed3y73da5.fsf-RvotKtm/pmVc2QSU14wbDhqUABtTHcxU/fObgANad5s@public.gmane.org>
2010-04-11 15:24       ` Trond Myklebust
2010-04-11 20:50         ` Trond Myklebust
2010-04-12 10:32           ` Arnaud Giersch

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=wwer5mo3hf9.fsf@powwow.iut-bm.univ-fcomte.fr \
    --to=arnaud.giersch-t9cnh8bv7n6vy8wrskpssihwmy4uyrew@public.gmane.org \
    --cc=linux-nfs@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.