Review of an NFS forced dismount option

Rick Macklem rmacklem at
Tue Jul 25 22:43:32 UTC 2017

I have put a patch on which I'd appreciate
any reviews of. It is an attempt at fixing the NFS client problem where a
"umount -f" of an NFS mount point gets hung because a "df" or non-forced "umount"
has already been done on the mount point.

Here's the summary for it:
If an NFS mount point is hung due to an unresponsive NFS server, a "umount -f" will unmount the mount point, if the "umount" executes the NFS VFS_UNMOUNT() call.
Unfortunately, this often won't happen. Typically this fails when a process, such as "df" or
a "umount" without "-f" is hung on the mountpoint while holding a lock, such as the vnode
lock for the mounted-on vnode.
This patch adds a new option to umount called "-N" which does the forced dismount but
bypasses the checking in umount.c (which often gets hung as above) and by doing an nfssvc() syscall to ensure that any process hung on the mount point fails, so any locks get released. It can then reliably do the forced dismount.
Unfortunately, since it doesn't do any checking, it only works if the mounted-on path is
specified exactly as it was at mount time (and is stored in mnt_stat.f_mntonname).

More information about the freebsd-fs mailing list