All of lore.kernel.org
 help / color / mirror / Atom feed
* BUG: cannot acquire lock twice with NFSv4
@ 2010-04-09 13:05 Arnaud Giersch
       [not found] ` <wwer5mo3hf9.fsf-RvotKtm/pmVc2QSU14wbDhqUABtTHcxU/fObgANad5s@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaud Giersch @ 2010-04-09 13:05 UTC (permalink / raw)
  To: linux-nfs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-12 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-09 13:05 BUG: cannot acquire lock twice with NFSv4 Arnaud Giersch
     [not found] ` <wwer5mo3hf9.fsf-RvotKtm/pmVc2QSU14wbDhqUABtTHcxU/fObgANad5s@public.gmane.org>
2010-04-10  8:46   ` 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

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.