NFSv4: /mnt/nfs was not found in /proc/mounts
This machine had a stale NFS mount. But attempting to unmount gave a rather strange message:
$ umount /mnt/nfs /mnt/nfs was not found in /proc/mountsLet's look at mtab first:
$ mount | grep nfs server:/mnt/export/dir0 on /mnt/nfs type nfs (ro,vers=4,addr=10.0.0.10,clientaddr=10.0.0.30)OK, but why isn't it found in /proc/mounts then?
$ grep nfs /proc/mounts
server:/mnt/export/dir0 /mnt/nfs\040(deleted) \
nfs4 ro,nosuid,nodev,noexec,relatime,\
vers=4,rsize=131072,wsize=131072,namlen=255,\
hard,proto=tcp,port=0,timeo=600,retrans=2,\
sec=sys,local_lock=none,clientaddr=10.0.0.30,\
minorversion=0,addr=10.0.0.10 0 0
Hah! Somehow the entry in /proc/mounts got mangled. OK, \040 is octal for SPACE. But umount(8) still fails:
$ umount /mnt/nfs\ \(deleted\) umount.nfs: /mnt/nfs (deleted): not found umount.nfs: /mnt/nfs (deleted): not foundApparently
umount(8) tried to find the entries from /proc/mounts in /etc/mtab but failed, due to the mismatch of both files. After adding \040(deleted) to the local-directory part in /etc/mtab, umount(8) did something:
$ umount /mnt/nfs* umount: /mnt/nfs Stale NFS file handleThe entry got removed from
/etc/mtab, but the mangled entry still shows up in /proc/mounts. Now all is left is a stale NFS file handle:
$ umount -f /mnt/nfs umount2: Stale NFS file handle umount: /mnt/nfs: Stale NFS file handleSadly, this could only be cured by a reboot :-\
Update: the "
Stale NFS file handle" error is covered quite nicely in this bugreport. According to this report, the error should be a thing of the past since Linux 3.12.