Bug 75421 - umount fails but it removes entry from /etc/mtab
Summary: umount fails but it removes entry from /etc/mtab
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mount
Version: 8.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Elliot Lee
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-10-08 11:56 UTC by diego.santacruz
Modified: 2007-04-18 16:47 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-01-14 17:10:38 UTC
Embargoed:


Attachments (Terms of Use)
Fix of problem (save errno across perror() call) (712 bytes, patch)
2002-10-08 12:00 UTC, diego.santacruz
no flags Details | Diff

Description diego.santacruz 2002-10-08 11:56:37 UTC
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):
mount-2.11r-10

How reproducible:
Always

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

Additional info:

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

Comment 1 diego.santacruz 2002-10-08 12:00:45 UTC
Created attachment 79344 [details]
Fix of problem (save errno across perror() call)

Comment 2 Elliot Lee 2003-01-14 17:10:38 UTC
fixed in 2.11y-2


Note You need to log in before you can comment on or make changes to this bug.