Skip to contentSkip to conversation

Problem: nfsd producing stales when restarting too fast

DISCUSSION Frank Steiner 2 participants 3 messages Aug 3, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

there seems to be a problem with the kernel nfsd on 2.6.7 when restarting the server too fast. I'm running 2.6.7 on both NFS server and client.

I've mounted two test volumes, both with -orw,nfsvers=3,rsize=8192,wsize=8192,hard,intr,nolock Using soft or hard and udp or tcp does not make any difference.

On the client that mounts the volumes (subdirs udp and tcp) I run loops like "while true; do date >> udp/bla; done"

Restarting the nfsserver with "/etc/init.d/nfsserver restart" (sometimes a few times, somtimes on the first try) ends up with both loops echoing "bash: udp/bla: Stale NFS file handle" forever.
But when I shutdown the nfsserver, wait 5 seconds and bring it up again, this never happens. And it does even bring back the loops to normal behaviour when they were stuck on stale fs before.

Ok, it seems that you just need to insert a sleep statement in the init script, but I guess this is not the desired behaviour of the nfs daemon.

Btw, it's not a problem with the init script, I can also produce this behaviour manually by /usr/sbin/exportfs -au
killall -9 nfsd
killall -9 /usr/sbin/rpc.mountd
[sleep 5]
/usr/sbin/exportfs -r
/usr/sbin/rpc.nfsd
/usr/sbin/rpc.mountd

Without the sleep, everything stales. With the sleep, it works fine.

cu,
Frank

Signature · 5 lines
Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *
#1 lore raw
Quoted 11 lines · On Tuesday August 3, [email protected] wrote:

Btw, it's not a problem with the init script, I can also produce this behaviour manually by /usr/sbin/exportfs -au
killall -9 nfsd
killall -9 /usr/sbin/rpc.mountd
[sleep 5]
/usr/sbin/exportfs -r
/usr/sbin/rpc.nfsd
/usr/sbin/rpc.mountd

Quoted 2 lines

Without the sleep, everything stales. With the sleep, it works fine.

Try doing the "exportfs -au" *after* killing nfsd.
Unexporting active filesystems while nfsd is running almost guarantees stale file handles.

NeilBrown

#2 lore raw
Quoted 3 lines · Neil Brown

Try doing the "exportfs -au" *after* killing nfsd.
Unexporting active filesystems while nfsd is running almost guarantees stale file handles.

Doesn't make a difference. Again, only a sleep (1 seems to be enough) prevents the stale fs.

Frank

Signature · 4 lines
Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049