Bug 198426 - /etc/mtab is not reliable
Summary: /etc/mtab is not reliable
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts   
(Show other bugs)
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-11 11:19 UTC by Karel Zak
Modified: 2014-03-17 03:00 UTC (History)
2 users (show)

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


Attachments (Terms of Use)

Description Karel Zak 2006-07-11 11:19:45 UTC
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-30 03:00:05 UTC
Thanks, changed in CVS.


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