NFS locking problems with 7.0-RELEASE

Bryan Alves bryanalves at gmail.com
Tue Dec 30 01:39:04 UTC 2008


I'm running a FreeBSD Server (7.0-RELEASE, latest patchlevel, problem has
existed on previous patchlevels).  Running an NFS server, with statd and
lockd.  Client is an Ubuntu 8.10 machine.  Of note is that the FreeBSD
server (in a home environment) is also running PF and doing the packet
filtering for the house.

When I export my home directory and mount it on my linux client, I run into
all sorts of problems with file locking.  The biggest problem is the
inability to run firefox.  When stracing an execution of firefox, execution
hangs when opening it's .parentlock file for F_GETLK.  I also notice
messages in /var/log/messages on the client on occasion:

Dec 29 20:08:01 balves-ubuntu-desktop kernel: [ 5430.560020] lockd: server
192.168.10.1 not responding, still trying
Dec 29 20:08:28 balves-ubuntu-desktop kernel: [ 5457.560725] lockd: server
192.168.10.1 OK

192.168.10.1 is the internal address for the FreeBSD server. Nothing related
to NFS appears in /var/log/messages on the FreeBSD server.

I've made sure to turn off scrubbing for PF on internal interfaces, because
of it's problems with NFS.  Of note is that things that don't need locks
(for example, video playback with some players, music playback, etc), works
fine on the nfs mount.  I have a device in my living room (a popcorn hour),
that connects to the FreeBSD server and streams via NFS without issue.  The
only problems I've come across occur with file locks.

Restarting various services (rpc, statd, lockd, nfsd) on the server doesn't
help, neither does remounting.  Rebooting doesn't help either.  The only
thing that makes the mount usable is using samba instead of nfs.  This is
unfortunate because samba is much slower on my network (> 20 MB/s drop in
throughput using samba instead of NFS).

Here is my pf.conf for those of you who want to verify that i've turned off
scrubbing correctly:

===BEGIN pf.conf===
ext_if          = "em1"
int_if          = "em0"
localnet        = $int_if:network
torrent_ports   = "57100:57199"
web_ports       = "81"
vpn_ports       = "1723"
gateway         = "192.168.10.1"
httpd_jail      = "192.168.10.200"
samba_jail      = "192.168.10.201"
slimserver_jail = "192.168.10.202"
torrent_jail    = "192.168.10.203"

set   skip on { lo0 }
set   loginterface $ext_if
#scrub in all
scrub in on $ext_if

altq on $ext_if bandwidth 4500Kb hfsc queue { q_high, q_med, q_low }
  queue q_high        bandwidth 25% priority 6 qlimit 250 hfsc
  queue q_med         bandwidth 45% priority 4 qlimit 250 hfsc (default)
  queue q_low         bandwidth 30% priority 3 qlimit 250 hfsc

nat on $ext_if from $localnet to any -> ($ext_if)

#Port Forwards
rdr on $ext_if proto tcp from any to any port ssh -> $gateway port ssh
rdr on $ext_if proto tcp from any to any port $web_ports -> $httpd_jail port
$web_ports
rdr on $ext_if proto tcp from any to any port $torrent_ports ->
$torrent_jail port $torrent_ports

#Nat Reflection
rdr on $int_if proto tcp from $localnet to $ext_if port ssh -> $gateway
rdr on $int_if proto tcp from $localnet to $ext_if port $web_ports ->
$httpd_jail
no nat on $int_if proto tcp from $int_if to $localnet
nat on $int_if proto tcp from $localnet to $gateway port ssh -> $int_if
nat on $int_if proto tcp from $localnet to $httpd_jail port $web_ports ->
$int_if

antispoof for $ext_if
block all

#In on ext_if
pass in on $ext_if proto tcp from any to any port $web_ports keep state
queue (q_high)
pass in on $ext_if proto { tcp, udp } from any to $torrent_jail keep state
queue (q_low)
pass in on $ext_if proto tcp from any to port ssh modulate state queue
(q_high)
pass in on $ext_if proto gre from any to any keep state queue (q_high)
pass in on $ext_if proto tcp from any to any port $vpn_ports keep state
queue (q_high)

#Out on ext_if
pass out on $ext_if proto tcp all modulate state queue (q_med)
pass out on $ext_if proto { udp, icmp } all keep state queue (q_med)
pass out on $ext_if proto gre all keep state queue (q_high)
pass out on $ext_if proto tcp from $torrent_jail to any keep state queue
(q_low)

#Allow all LAN traffic
pass in on $int_if from $localnet to any keep state
pass out on $int_if from any to $localnet keep state

===END pf.conf===

I realize that the linux NFS client implementation isn't spectacular, but
the same ubuntu setup works when connected to a netapp, which leads me to
believe that the problem is with the freebsd nfs server implementation.

If anyone can suggest some additional troubleshooting steps to provide some
more information, or propose some suggested solutions, it would be
appreciated.

--Bryan


More information about the freebsd-fs mailing list