2004-06-09 19:17:58

by Ruben Puettmann

[permalink] [raw]
Subject: 2.6.X File locking on NFS stil broken


hello,


I have a big iproblem with the nfs file locking on some 2.6 er kernel

Kernel Server: 2.4.9
Kernel Client: 2.6.7-rc3-bk2
2.6.6-rc3-mm2
2.6.5

mount options :

10.0.0.149:/export /mnt/server nfs rw,auto,soft,bg,timeo=12,retrans=3,in tr,rsize=8192,wsize=8192,mountvers=3,nfsvers=3,udp 0 0

nfs-utils : 1.0.6

Both Server an Client Debian Sarge. Wiht kernel 2.4.21-pre5 the locking
runs very fine against the server.

This little testscript I used ( got it from a friend):

#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>

int main(int c, char **v)
{
for (++v, --c; c--; ++v) {
struct flock lck = {F_RDLCK, SEEK_SET, 0, 0}; /* whole file */
int fd = open(*v, O_RDONLY);
if ( fd < 0 )
fprintf(stderr, "%s: %s\n", *v, strerror(errno));
else {
if ( fcntl(fd, F_SETLK, &lck) < 0 )
fprintf(stderr, "%s[%d]: %s\n", *v, lck.l_pid, strerror(errno));
else
printf("%s..ok\n", *v);
close(fd);
}
}
return 0;
}


The programm hangs after executing ./script testfile.


Ruben





--
Ruben Puettmann
[email protected]
http://www.puettmann.net


2004-06-09 20:41:12

by Trond Myklebust

[permalink] [raw]
Subject: Re: 2.6.X File locking on NFS stil broken

P=E5 on , 09/06/2004 klokka 15:17, skreiv Ruben Puettmann:
> hello,
>=20
>=20
> I have a big iproblem with the nfs file locking on some 2.6 er kernel=
=20
>=20
> Kernel Server: 2.4.9
> Kernel Client: 2.6.7-rc3-bk2
> 2.6.6-rc3-mm2
> 2.6.5
<snip>
> This little testscript I used ( got it from a friend):

That script works fine for me: I haven't seen any hangs on locking in
any of the 2.6 series kernels so far.

What does 'rpcinfo -p' show on the client and server?

Cheers,
Trond

2004-06-09 21:24:30

by Ruben Puettmann

[permalink] [raw]
Subject: Re: 2.6.X File locking on NFS stil broken

On Wed, Jun 09, 2004 at 05:13:43PM -0400, Trond Myklebust wrote:
> P? on , 09/06/2004 klokka 17:03, skreiv Ruben Puettmann:
>
> > attached the strace and one tcpdump from the testprogramm.
>
> According to that tcpdump, the server is denying you the lock because it
> is still in its grace period.
>
> During that period only clients that held locks before the server
> rebooted are allowed to reclaim those locks. Your client will need to
> wait until that grace period is over (usually ~ 1 minute or so).
>

I have done a reboot on teh server ( It was up for over 315 day's ;-( )
now all runs fine seems to be an race condition. I will take a look on
it if this happend again.

Thanks for your help !!


Ruben

--
Ruben Puettmann
[email protected]
http://www.puettmann.net


Attachments:
(No filename) (800.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments