# Missing "rpc.umntall" call to notify NFS server that client has shut down.



## k.jacker (Sep 14, 2018)

This is a problem that has existed for me since FreeBSD 10.3-RELEASE and I posted on that topic here on the forum and opended a bug on this about a year ago.
The bug is still open, which is no wonder. A year ago I was totally wrong about the cause; I thought it was a autofs/autounmountd problem.

In short:
Since then I have learned a lot while debugging autofs and NFS and looking into the rc system (without fully understanding it honestly).

When a NFS client is shut down, the NFS server does not get notified. `showmount` and `cat /var/db/mountdtab` (on the NFS server) shows the server still thinks the client is connected. When shutting down a client, there seems to be missing a `rpc.umntall` call.
Goes easily undetected. When client boots, from /etc/rc.d/nfsclient, the missing `rpc.umntall -k` call is executed, which then removes the clients /var/db/mounttab and notifies the NFS server.
Using autounmountd was helpful in debugging, since it can remove mounts from the kernel without calling `rpc.umntall -k` itself. Shows right away the rpc call is missing.
There are several ways to reveal more obvious that something doesn't work right. Calling `automount -u` (or simply wait for autounmountd) to disconnect the automounted NFS mounts and then again automounting a NFS mount, will grow the /var/db/mount(d)tab both on the client on the server with identical entries. That doesn't keep NFS from working in any way, though.

Another approach is to simply remove *nfs_client_enable="YES"* from /etc/rc.conf to prevent it from executing `rpc.umntall -k` on boot. This will show that there hasn't been any rpc call when the client was shut down, as the mount entries on the client and the server are still present after the clients reboot.

The problem exists without the use of autofs as well, it was just helpfull while debugging.
Manually mounted NFS mounts or via /etc/fstab show the same missing rpc call when the
client is shut down. Only manually executing `umount ...` makes the neccessary rpc call to notify the NFS server of the disconnection.  

All this can easily be cleaned up by executing `rpc.umntall -k` at any time on the client
and it is what I do. To successfully use autofs with NFS I run `rpc.umntall -k` every hour from cron on I have added `rpc.umntall` to the very end of /etc/rc.shutdown.

The problem lies in NFS though, not in autofs.


After spending so much debugging that (for a while on two dedicated machines client/server), reading and learning about NFS and the rc system I'm still a little in doubt that something so well established like NFS could be broken.
This started on FreeBSD 10.3-RELEASE and does still exist on 11.2-RELEASE-p3.
What do you think?


----------

