NFS v4 Callbacks in RedHat/CentOS Howto

Posted: 2014-01-03 16:05:49 by Alasdair Keyes

Direct Link | RSS feed


NFS callbacks are a feature introduced in NFS v4 to prevent deadlocks. If two clients try to access the same file, the server can recall the delegation via an asynchronous callback to one client should there be a conflicting request for access to the file from a different client.

Unlike other NFS services such as lockd or statd the callbacks are setup on the client and not the server.

This sounds good but it doesn't seem to have been implemented very well and no real documentation on exactly how to use it or the correct way to set this up. There's no default NFS callback port, it's up to the sysadmin to choose a port and set it.

There are many pages on the net explaining how you can echo a port number into a /proc path (Which doesn't work if the NFS file is auto-mounted before this port is set) Or by setting /proc values in /etc/sysctl.conf, which doesn't seem to work at all.

I did stumble across this solution, however...

Choose a port This is entirely up to you, for this example, we'll set port 10000

Open the firewall on the NFS client

 iptables -A INPUT -p tcp -m tcp --dport 10000 -m iprange --src-range x.x.x.x-x.x.x.y -m comment --comment "NFS TCP callback" -j ACCEPT

Set the callback port with modprobe Create a file called /etc/modprobe.d/nfscallback.conf with the following text

options nfs callback_tcpport=10000

Restart your NFS client and then check netstat to see if it's listening

# netstat -antp | grep 10000
tcp     0   0 0.0.0.0:10000        0.0.0.0:*      LISTEN    -

That's it all setup!


If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

© Alasdair Keyes

IT Consultancy Services

I'm now available for IT consultancy and software development services - Cloudee LTD.



Happy user of Digital Ocean (Affiliate link)


Version:master-3cbfa44ade


Validate HTML 5