Odi's astoundingly incomplete notes

New entries | Code

vim hangs on NFS shares

I had a strange problem on an NFS mounted share. I am able to access the directory, list file, create files all right. But as soon as I invoke vim on a file the vim process just hangs. You can't kill the process either. It turns out the process waits for the NFS filesystem in some way. The syslog proves this with lines like:
Jul 3 17:21:23 livorno kernel: nfs: server not responding, still trying
Logging in as root and doing umount -f on the share unlocks the process.

By analyzing packet dump of the NFS traffic (tcpdump -s 9000 -w pack host livorno and host firenze and port 2049) in Wireshark I found that lots of fragmented UDP packets were transmitted. On the server side ifconfig reports lots of receive errors. And /proc/net/snmp reports many fragmentation errors, more than /proc/sys/net/ipv4/ipfrag_low_thresh. That leads me to the conclusion that the server's kernel throws away all fragmented UDP packets, thus inhibiting proper NFS communication.

I solved this problem by specifying a rsize and wsize smaller than the MTU (1024 < 1500) in the mount options of the share in /etc/fstab:  /data/shared  nfs auto,rw,rsize=1024,wsize=1024
It seems many people have had this problem before on several platforms. But nobody has ever published a solution. Here your are.

posted on 2007-07-03 18:11 UTC in Code | 0 comments | permalink