util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* losetup: failed to setup loop device > 1
@ 2014-10-06 16:35 Francis Moreau
  2014-10-06 17:40 ` Karel Zak
  0 siblings, 1 reply; 9+ messages in thread
From: Francis Moreau @ 2014-10-06 16:35 UTC (permalink / raw)
  To: util-linux

Hello,

I don't really understand what's going on, it seems that I can't setup a
loop device if loop0 is already in use.

If no loop is in use, everything works as expected:

# LOOPDEV_DEBUG=1 losetup -f disk.img
loopdev:  [0x7fffaf57c898]: find_unused requested
loopdev:  [0x7fffaf57c898]: loop0 successfully assigned
loopdev:  [0x7fffaf57c898]: find_unused by loop-control [rc=0]
loopdev:  [0x7fffaf57c898]: set backing file=/root/diskt.img
loopdev:  [0x7fffaf57c898]: device setup requested
loopdev:  [0x7fffaf57c898]: setup: backing file open: OK
loopdev:  [0x7fffaf57c898]: open ok
loopdev:  [0x7fffaf57c898]: setup: device open: OK
loopdev:  [0x7fffaf57c898]: setup: LOOP_SET_FD: OK
loopdev:  [0x7fffaf57c898]: setup: LOOP_SET_STATUS64: OK
loopdev:  [0x7fffaf57c898]: setup success [rc=0]
loopdev:  [0x7fffaf57c898]: de-initialize
loopdev:  [0x7fffaf57c898]: iter: de-initialize

However if loop0 is busy, it fails this way:

# LOOPDEV_DEBUG=1 losetup -f disk.img
loopdev:  [0x7fff15a8da98]: find_unused requested
loopdev:  [0x7fff15a8da98]: loop1 successfully assigned
loopdev:  [0x7fff15a8da98]: find_unused by loop-control [rc=0]
loopdev:  [0x7fff15a8da98]: set backing file=/root/disk.img
loopdev:  [0x7fff15a8da98]: device setup requested
loopdev:  [0x7fff15a8da98]: setup: backing file open: OK
loopdev:  [0x7fff15a8da98]: open failed
loopdev:  [0x7fff15a8da98]: setup failed [rc=-6]
losetup: failed to setup loop device: No such device or address
loopdev:  [0x7fff15a8da98]: de-initialize
loopdev:  [0x7fff15a8da98]: iter: de-initialize

The weird thing is that loop1 is succesfully found/allocated but it
failed during the open() of the device.

strace shows:
...
open("/dev/loop-control", O_RDWR)       = 0
ioctl(0, 0x4c82, 0x3)                   = 1
...
open("/dev/loop1", O_RDWR)              = -1 ENXIO (No such device or
address)
...

The loop min count for that system is 8 so it shouldn't be a problem to
setup 2 loop devices and the trace shows that requesting a new loop works.

One last details is that the system uses pretty old stuff: kernel
3.4.50, util-linux 2.21.1.

Could anybody give me some help ?

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-08 10:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-06 16:35 losetup: failed to setup loop device > 1 Francis Moreau
2014-10-06 17:40 ` Karel Zak
2014-10-06 20:59   ` Francis Moreau
2014-10-07  9:17     ` Karel Zak
2014-10-07  9:32       ` Francis Moreau
2014-10-08  8:57         ` Francis Moreau
2014-10-08  9:44           ` Karel Zak
2014-10-08 10:05             ` Francis Moreau
2014-10-08 10:58       ` Francis Moreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).