umount.nfs: Distinguish between nfs4 and nfs mounts
Neil Brown reports that umount.nfs is still confused by "-t nfs -o
vers=4" mounts.
/etc/mtab can be confused. /proc/mounts is authoritative on the
fstype of a mount. Have umount.nfs consult it to determine which
mechanism to use for unmounting. The code to read /proc/mounts was
lifted from the nfsstat command.
The code introduced by this patch may look like belt-n-suspenders, but
we have two use cases to consider:
1. Old kernels don't support the "vers=4" mount option, so
umount.nfs must look for the "nfs4" fstype
2. Upcoming kernels may eliminate support the "nfs4" fstype, so
umount.nfs must look for the "vers=4" mount option
Thus this logic checks for "nfs4" first then looks for the NFS version
setting.
Note that we could handle unmounting entirely in the kernel, but that
won't help older kernels that have this issue.