Bug 198426 - /etc/mtab is not reliable
/etc/mtab is not reliable
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
6
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-11 07:19 EDT by Karel Zak
Modified: 2014-03-16 23:00 EDT (History)
2 users (show)

See Also:
Fixed In Version: 8.38-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-02 20:34:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Karel Zak 2006-07-11 07:19:45 EDT
initscripts-8.35/rc.d/init.d/halt:

# Try all file systems other than root and RAM disks, one last time.
mount |  awk '!/( \/ |^\/dev\/root|^\/dev\/ram| \/proc )/ { print $3 }' | sort
-r | \
  while read line; do
    fstab-decode umount -f $line
done

I think the output from mount command should be replaced with /proc/mounts. The
/etc/mtab doesn't contain mountpoints from the "mount --rbind" command. It means
this script doesn't umount all pointpoins.

# mkdir -p /mnt/foo/bar
# mount /dev/dm-1 /mnt/foo/bar

# mkdir -p /mnt/foo2
# mount --rbind /mnt/foo /mnt/foo2

# umount /mnt/foo2
umount: /mnt/foo2: device is busy
umount: /mnt/foo2: device is busy

because:

# mount | grep foo
/dev/dm-1 on /mnt/foo/bar type ext3 (rw)
/mnt/foo on /mnt/foo2 type none (rw,bind)

(note: there is no info about /mnt/foo2/bar in mtab)

# cat /proc/mounts | grep foo
/dev/dm-1 /mnt/foo/bar ext3 rw,data=ordered 0 0
/dev/root /mnt/foo2 ext3 rw,data=ordered 0 0
/dev/dm-1 /mnt/foo2/bar ext3 rw,data=ordered 0 0
          ^^^^^^^^^^^^
you have to umount recursive:

# umount /mnt/foo2/bar
# umount /mnt/foo2

For more datails see bug #194342.
Comment 1 Miloslav Trmač 2006-07-29 23:00:05 EDT
Thanks, changed in CVS.

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