From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.5 (X11; Linux i686; U;) Gecko/20020809
Description of problem:
When using the -f flag and stderr is directed to /dev/null if the umount syscall
fails, umount believes it succeded and removes the entry from /etc/mtab.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Mount a nfs share at /mnt/test
2. 'cd /mnt/test' so that share is not umountable
3. 'umount -f /mnt/test 2>/dev/null' (stderr must be redirected)
Actual Results: The share is still mounted (as expected) but there is no entry
in /etc/mtab for it.
Expected Results: The umount command should fail and not modify the /etc/mtab file
This occurs because errno is not saved across a perror() call. umount2() is
called and fails (because mount point is busy), then perror() fails (because
stderr redirected to /dev/null) and modifies errno, yet errno is consulted as
being the error code of the failed umount2() call.
The stderr redirected to /dev/null occurs in all initscripts since commands are
run through initlog. It bites particularly hard in '/etc/init.d/netfs stop'. So
it's important to fix.
This was already reported back in Dec-2001 for RedHat Linux 7.1, but seems to
have been ignored since then. See bug #57286
Created attachment 79344 [details]
Fix of problem (save errno across perror() call)
fixed in 2.11y-2