Subject: bin/1412: umount can't umount stale nfs file systems
To: None <gnats-bugs@NetBSD.ORG>
From: Arne Juul <arnej@itea.unit.no>
List: netbsd-bugs
Date: 08/27/1995 18:41:10
>Number:         1412
>Category:       bin
>Synopsis:       umount can't umount stale nfs file systems
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 27 12:50:01 1995
>Last-Modified:
>Originator:     Arne H Juul
>Organization:
University of Trondheim, Norway
>Release:        1.0
>Environment:
	Observed on i386 machine running 1.0 with standard patches.
	This is probably machine-independent and also happens with -current.
System: NetBSD skarven.itea.unit.no 1.0 NetBSD 1.0 (SKRVN) #9: Thu May 18 00:15:54 MET DST 1995 root@skarven.itea.unit.no:/local/usr/src/sys/arch/i386/compile/SKRVN i386


>Description:
	If a NetBSD machine mounts a filesystem with NFS from
another machine, and the other machine is down or the filesystem
is unavailable for some reason (in my case, because the disk was
repartitioned), the umount program is unable to umount the file
system.
	However, the unmount system call is fully capable of
unmounting the filesystem, so by writing a C program it is
possible to umount the file system.  In my opinion this should
never be necessary.
	

>How-To-Repeat:
	One way to repeat this is to export a file system from
some machine to a netbsd machine, mount it from there, and then
un-export the file system.  Then, all access to the filesystem
gives "Stale NFS file handle".  Umount (and also umount -f) gives
the message "umount: server:/filesys: No such file or directory".
Writing a C program allows unmounting. In my example situation:
The /export/store partition on the server 'ernie' has been
re-partitioned.

skarven:/home/skarven/arnej:(304)# mount
/dev/sd0a on / type ufs (local)
/dev/sd0e on /var type ufs (local)
/dev/sd0f on /usr type ufs (local)
/dev/sd1e on /local type ufs (NFS exported, local)
ernie:/export/store on /local/store/store/ernie type nfs (read-only)
ernie:/export/unit on /unit/unit/uernie type nfs
/dev/sd2a on /export/ftpsearch type ufs (NFS exported, local)

skarven:~:(305)# umount /local/store/store/ernie
umount: ernie:/export/store: No such file or directory

skarven:~:(306)# cd /tmp
skarven:/tmp:(307)# cat > umount.c
main(){unmount("/local/store/store/ernie");}

skarven:/tmp:(308)# cc umount.c
skarven:/tmp:(309)# ./a.out

skarven:/tmp:(310)# mount
/dev/sd0a on / type ufs (local)
/dev/sd0e on /var type ufs (local)
/dev/sd0f on /usr type ufs (local)
/dev/sd1e on /local type ufs (NFS exported, local)
ernie:/export/unit on /unit/unit/uernie type nfs
/dev/sd2a on /export/ftpsearch type ufs (NFS exported, local)


>Fix:
	None known to me.
>Audit-Trail:
>Unformatted: