symlink to /proc/mounts

Richard Lightman richard at nezumi.plus.com
Thu Jan 2 17:57:50 PST 2003


* Ian Molton <spyro at f2s.com> [2003-01-02 23:16]:
> On Thu, 2 Jan 2003 10:24:26 +0000 (UTC)
> richard at nezumi.plus.com (Richard Lightman) wrote:
> 
> > 
> > Is there some problem with the /etc/mtab symlink and loop devices that
> > does not show up because I have devfs and crypto?
> 
> normally, eventually, the kernel runs out of loop devcices as they are
> not removed when you unmount (when you use the symlink).
> 
My man page for mount gets modified by the crypto patch, so it would
be a good idea to check my results. From the umount man-page:

   -d     In case the unmounted device was a loop device, also free
          this loop device.

THE LOOP DEVICE

   The umount command will free the loop device (if any) associated
   with the mount, in case it finds the option `loop=...' in
   /etc/mtab, or when the -d option was given. Any pending loop devices
   can be freed using `losetup -d', see losetup(8).

The entries for a loop back device:
/etc/mtab:    /etc/secret_crypt /etc/secrets cramfs ro,noexec,nosuid,nodev,loop=/dev/loop/0,encryption=aes,keybits=192 0 0
/proc/mounts: /dev/loop/0 /etc/secrets cramfs ro,nosuid,nodev,noexec 0 0

What happens:

             symlink                 file
umount -d    unmounts and detaches   unmounts and detaches 
umount       unmounts                unmounts and detaches

So everything is working as documented.


This is not a problem with the mtab symlink, the kernel or umount.
If you are running out of loop devices it is because you neglected
to type the -d option.

If you are unhappy about umount not detaching the loop back device
when mtab is a symlink and -d is not specified, by all means change
the documentation so we have a bug. There is nothing to stop umount
from spotting the device is /dev/loop/*, and detaching it, so the
'bug' could be fixed without a kernel patch.


There are places where umount could have problems with the symlink,
but AFAICT the loop back device is not one of them.

Richard

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list