[Pkg-sysvinit-devel] Bug#494001: `mount -o loop' runs out of loop devices

Roger Leigh rleigh at codelibre.net
Fri Jun 5 16:15:15 UTC 2009


On Fri, Jun 05, 2009 at 12:02:11PM +1200, Dmitry Maksyoma wrote:
> On Thu, Jun 04, 2009 at 07:18:29PM +0100, Roger Leigh wrote:
> > However, if Dmitry can confirm this is a real bug (as opposed to a
> > documentation issue, in which case it still needs a bug against
> > mount), then the solution is fixing mount rather than not fixing this
> > bug.
> 
> Running out of loop devices is a real bug, documented in
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531371.

Confirmed.  The cause:

/etc/mtab:
/tmp/image2 /mnt ext2 rw,loop=/dev/loop0 0 0

/proc/mounts:
/dev/loop0 /mnt ext2 rw,errors=continue 0 0

So, it's lying about what's really mounted in /etc/mtab, and
umount uses this fact to losetup -d the loop device.

Solution: Fix mount to add an option such as auto-detach to
the mount options when using -o loop which tells us
unambiguously in all situations that we want to automatically
detach the loop.

This is a bug in mount, so really needs fixing there.  I checked
the source briefly and there's some bizarre stuff in there such
as loop=spec which I can't see actually used.  Should probably
be removed.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.



More information about the Pkg-sysvinit-devel mailing list