2.6.X File locking on NFS stil broken
Subsystems (2)
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.5mount 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
Signature · 3 lines
Ruben Puettmann [email protected] http://www.puettmann.net
P=E5 on , 09/06/2004 klokka 15:17, skreiv Ruben Puettmann:
Quoted 4 lines
hello,
=20
=20
I have a big iproblem with the nfs file locking on some 2.6 er kernel=
=20
Quoted 5 lines
=20
Kernel Server: 2.4.9
Kernel Client: 2.6.7-rc3-bk22.6.6-rc3-mm2 2.6.5
<snip>
Quoted 1 line
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
Quoted 2 lines · Trond Myklebust
That script works fine for me: I haven't seen any hangs on locking in any of the 2.6 series kernels so far.
If I mount it with nolock it runs fine too ;-). I have not enough C knowledge to see whree the bug is.
Quoted 3 lines
What does 'rpcinfo -p' show on the client and server?
Server :
sslnfs:~# rpcinfo -p
Program Vers Proto Port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 759 status
100024 1 tcp 762 status
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100021 1 udp 32779 nlockmgr
100021 3 udp 32779 nlockmgr
100021 4 udp 32779 nlockmgr
100005 1 udp 901 mountd
100005 1 tcp 904 mountd
100005 2 udp 901 mountd
100005 2 tcp 904 mountd
100005 3 udp 901 mountd
100005 3 tcp 904 mountdClient:
root@www10:[~] > rpcinfo -p
Program Vers Proto Port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100021 1 udp 32768 nlockmgr
100021 3 udp 32768 nlockmgr
100021 4 udp 32768 nlockmgr
100024 1 udp 938 status
100024 1 tcp 941 statusRuben
Signature · 3 lines
Ruben Puettmann [email protected] http://www.puettmann.net
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Trond Myklebust
På on , 09/06/2004 klokka 17:03, skreiv Ruben Puettmann:
Quoted 1 line
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
Signature · 3 lines
Ruben Puettmann [email protected] http://www.puettmann.net
Quoted 8 lines · Ruben Puettmann
Quoted 7 lines · Trond Myklebust
P? on , 09/06/2004 klokka 17:03, skreiv Ruben Puettmann:
Quoted 1 line
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.
Quoted 7 lines
Quoted 3 lines
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.
Did you change libc and/or your DNS configuration without restarting nfs-common? (statd/lockd)
Signature · 1 line
Ryan Anderson