[Pkg-sysvinit-devel] Unexpected problem with
/etc/mtab -> /proc/mounts
Thomas Hood
jdthood at yahoo.co.uk
Mon Jan 23 09:14:10 UTC 2006
Miquel van Smoorenburg wrote:
> In this case mount does the
> losetup for you, and it records that fact in /etc/mtab. When you
> umount /mnt/loop it also losetup -d's for you. You don't have that info
> in /proc/mounts.
>
> root at laptop:/mnt# mount -o loop /mnt/foo /mnt
> root at laptop:/mnt# grep /mnt /etc/mtab
> /mnt/foo /mnt ext3 rw,loop=/dev/loop0 0 0
> root at laptop:/mnt# grep /mnt /proc/mounts
> /dev/loop0 /mnt ext3 rw 0 0
>
> See the difference ?
Yep.
Note, however, that in changing umountfs to read /proc/mounts instead of /etc/mtab
to get the list of mounts we aren't ignoring the information in mtab.
Look at umountfs in 2.86.ds1-11. A while loop reads through /proc/mounts to compile
a list of DIRS to unmount; then the script does this:
umount -f -r -d $DIRS
Now (I presume) umount will still consult /etc/mtab for each directory named and will
use any information in there that's available.
(/me now worries about what happens when a loopback mount is _not_ listed in mtab.)
I just tested the case where a loopback mount is listed in /proc/mounts but
not in /etc/mtab. The above command _does_ still unmount the loop fs.
Anyway, it's good to discuss these points.
--
Thomas
More information about the Pkg-sysvinit-devel
mailing list